Search code examples
c#asp.net-core-2.1ingres

Connecting to Ingres DB from .net Core 2.1


I am developing a .net core 2.1 API that needs to connect to an older Ingres DB.

In previous .net frameworks I have been able to use Ingres Client found here https://www.nuget.org/packages/Ingres.Client/1.0.1

However this is not compatible with .net core 2.1 and the last update was about 3 years ago! Some key files are missing which is causing runtime errors.

Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll

So I just wondered if anyone had any experience with connecting to Ingres from .net core 2.1 and knew of a way to do it. Or any suggestions or strategies to try would be appreciated.

Regards.


Solution

  • I managed to do this with Ingres ODBC driver. Available drivers in Windows are accessible from: Control Panel > Administrative Tools > ODBC Data Source Administrator. Select 'Add...' to find the name of installed Ingres ODBC driver (e.g. 'Ingres XC').

    var connectionString = "Driver=Ingres XC;Server=@<db-server-ip>,tcp_ip,II;UID=ingresuser;PWD=password;database=mydatabase";
    
    using (OdbcConnection connection = new OdbcConnection(connectionString))
    {
    // ...
    }