Dear Folks,
Hope you are doing fine.
I am trying to connect Hana DB from .NET core application developed in .net6.0
The application is just trying to connect HANA DB and execute simple query.
I same application is running fine on local machine which uses SAP Hana SDK.
However once deployed on cloud foundry the application is throwing exception.
14 Dec 2022, 11:13:18 (GMT+05:30) - [APP/PROC/WEB/0]<br>---> System.IO.FileNotFoundException: Cannot find a matching libadonetHDB.dll with version 2.14.22 - check the location in the HDBDOTNETCORE or PATH / LD_LIBRARY_PATH / DYLD_LIBRARY_PATH environment variables
I have copied 'dotnetcore' folder from SAP Hana SDK in the application folder for deployment.
public HomeController(ILogger<HomeController> logger)<br> {<br> _logger = logger;<br> <br> HanaConnection conn = new HanaConnection("Server=hanaconnectionstring; UserID=login;Password=password");<br> conn.Open();<br> var query = "test query";<br> using (var cmd = new HanaCommand(query, conn))<br> using (var reader = cmd.ExecuteReader()) <br> {<br> Console.WriteLine("Query result:");<br> // Print column names<br> var sbCol = new System.Text.StringBuilder();<br> for (var i = 0; i < reader.FieldCount; i++)<br> {<br> sbCol.Append(reader.GetName(i).PadRight(20));<br> }<br> Console.WriteLine(sbCol.ToString());<br> // Print rows<br> while (reader.Read())<br> {<br> var sbRow = new System.Text.StringBuilder();<br> for (var i = 0; i < reader.FieldCount; i++)<br> {<br> sbRow.Append(reader[i].ToString().PadRight(20));<br> }<br> Console.WriteLine(sbRow.ToString());<br> } conn.Close();<br> }<br> }
I have even tried copied libadonetHDB.dll and dependencies in project folder still the issue is not resolved.
In csproj file I have added below entries.
<ItemGroup><br> <Reference Include="Sap.Data.Hana.Core.v2.1"><br> <HintPath>dotnetcore\v2.1\Sap.Data.Hana.Core.v2.1.dll</HintPath><br> </Reference><br> <Reference Include="libadonetHDB"><br> <HintPath>dotnetcore\libadonetHDB.dll</HintPath><br> </Reference><br> </ItemGroup>
Thanks in advance.
Regards,
Sumedh Ahire