0

I'm developing a .net core application in which I want to access data from external SAP Hana Databases.

Since I only want to execute Queries on the SAP Hana Database I am not able to have a referencing model in my .net core application. Since the official SAP Hana Driver is only available for windows, I tried with linq2db.

I tried these answers and tried some things myselfs.

I'm either getting

LinqToDB.LinqToDBException: Configuration 'Server=[IP];databaseName=HXE;UserID=SYSTEM;Password=[PASSWORD]' is not defined.

or

System.IO.FileNotFoundException: Could not load file or assembly 'Sap.Data.Hana, Culture=neutral, PublicKeyToken=null'.

For development purposes I've set up the SAP Hana Express VM as described here. The installation is successful and I can interact with my Hana DB through DBeaver as proposed here.

I did not find adequate informations in the linq2db documentation as well.

I would be extremely happy if someone could post an example on how to achieve a simple Query Call to an external SAP Hana Database without mapping tables to classes. If that's not possible, what would you propose as an alternative?

FBeMu6E4
  • 1
  • 1

1 Answers1

1

Right now linq2db supports only netfx driver for HANA. .NET Core driver became available to general public only in august, so we didn't added support for it yet, but it is planned for linq2db version 3. You can track it here https://github.com/linq2db/linq2db/issues/1764, hope it will take 2-3 weeks to release 3.0 preview with this driver included.

Also we have ODBC provider for HANA, but it is not enabled for .NET Core builds. In linq2db v3 we plan to enable it, so it should be possible to use it from non-windows platforms (no promises here, but we really need it for our CI testing, so we will do all we can here).

  • Great to hear that! Will it be possible to execute simple queries to the Hana DB without having to have analogue classes in the .NET Core Project? – FBeMu6E4 Sep 27 '19 at 07:31
  • Yes. But I would recommend to look at new FromSql API if you want to use raw queries: https://github.com/linq2db/linq2db/blob/master/Tests/Linq/Linq/FromSqlTests.cs –  Sep 27 '19 at 07:44
  • FYI, .net core support for native (windows) and odbc providers is ready for v3, so you can try it from here https://github.com/linq2db/linq2db/pull/1917 –  Oct 06 '19 at 11:38