Hi Tony,
Yes, I figured out the issue and found a solution. The issue is that the IBM.EntityFrameworkCore package only supports DRDA connections to the Informix Database. In my case there wasn't a DRDA listener configured on the database. Only SQLI. See this posing:
Connecting Informix database with .NET Provider - Stack Overflow. So your options are either enable a DRDA Listener on the Informix DB Server, or you can move to the
IBM Informix .NET Provider (i.e. Informix.Net.Core.dll), which is a .NET Core wrapper around the CPP ODBC driver. In my particular case, I have no control over the database side of things, so I ended up having to use the
IBM Informix .NET Provider(Informix.Net.Core.dll). It's not ideal, but it works.
Hope you find this information helpful.
------------------------------
Loyd Vest
------------------------------
Original Message:
Sent: Thu April 29, 2021 10:51 AM
From: Toni Petrovic
Subject: Unable to connect to Informix 12.10 Database from IBM.EntityFrameworkCore
Hello, have you found any solution for this?
Is this connection string even valid? I can't find any documentation on this nor the examples.
Please let me know if you have any info, even if you didn't manage to solve this in the end.
Thank you!
------------------------------
Toni Petrovic
Original Message:
Sent: Thu January 28, 2021 12:47 PM
From: Loyd Vest
Subject: Unable to connect to Informix 12.10 Database from IBM.EntityFrameworkCore
I'm attempting to built a .NET Core application using Visual Studio 2019, targeting .NET Core 3.1. I'm attempting to build my model and DbContext (i.e. Database-First approach) via the Scaffold-DbContext command of Package Manager Console. I'm getting an exception in the Package Manager Console, with the following error:
****************************************************
IBM.Data.DB2.Core.DB2Exception (0x80004005): ERROR [08001] [IBM] SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "10.20.10.126". Communication function detecting the error: "recv". Protocol specific error code(s): "*", "*", "0". SQLSTATE=08001
at IBM.Data.DB2.Core.DB2ConnPool.Open(DB2Connection connection, String& szConnectionString, DB2ConnSettings& ppSettings, Object& ppConn)
at IBM.Data.DB2.Core.DB2Connection.Open()
****************************************************
Here's the command that I'm issuing in PMC with the IP address, user id, and password x'ed out:
Scaffold-DbContext -Connection "Database=cvp_data;Server=xxx.xxx.xxx.xxx:1526;UID=xxxxxxx;PWD=xxxxxxxx" -Provider IBM.EntityFrameworkCore -OutputDir Models -Context CiscoCVPDbContext
I also just created simple console application, which I installed the IBM.Data.DB2.Core package and just attempted to open a connection to the database, using the following code and get exactly the same error:
DB2ConnectionStringBuilder connStringBld = new DB2ConnectionStringBuilder();
connStringBld.Database = "cvp_data";
connStringBld.UserID = "xxxxxxxx";
connStringBld.Password = "xxxxxxxx";
connStringBld.Server = "xxx.xxx.xxx.xxx:1526";
using (DB2Connection conn = new DB2Connection(connStringBld.ConnectionString))
{
try
{
conn.Open();
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
}
Does anyone have any idea what I could be doing wrong? Sure would appreciate some help.
------------------------------
Loyd Vest
------------------------------
#DataManagementGlobal
#DataServerDrivers