Global Data Management Forum

  • 1.  Unable to connect to Informix 12.10 Database from IBM.EntityFrameworkCore

    Posted Thu January 28, 2021 05:16 PM
    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


  • 2.  RE: Unable to connect to Informix 12.10 Database from IBM.EntityFrameworkCore

    Posted Thu April 29, 2021 02:58 PM

    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
    ------------------------------



  • 3.  RE: Unable to connect to Informix 12.10 Database from IBM.EntityFrameworkCore

    Posted Mon May 03, 2021 02:20 PM
    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
    ------------------------------



  • 4.  RE: Unable to connect to Informix 12.10 Database from IBM.EntityFrameworkCore

    Posted Mon May 03, 2021 04:37 PM
    I found the issue and a solution. The issue I was having is the IBM Data Server .NET Provider (i.e. IBM.Data.DB2.Core) only supports DRDA communication to the Server. Unfortunately the server I as connecting to didn't have a DRDA listener enabled. I have no control over this database server, so can't enable an DRDA listener. See this link for an explanation: Connecting Informix database with .NET Provider - Stack Overflow. So you have two options to solve the problem. 1. Enable a DRDA listener. 2. If you are stuck using SQLI to communicate to the server, like I was, and you are running on a Windows platform, you can use the IBM Informix .NET Core Provider (i.e. Informix.Net.Core.dll), which is a .NET Core Wrapper around the CPP ODBC driver. You can find the Informix.Net.Core.dll in the /bin directory where you installed the IBM Informix Client SDK (e.g. C:\Program Files\IBM Informix Client-SDK\bin). If you aren't on a windows platform, then I afraid I don't have a solution for you. 

    The Informix .NET Core Provider is written by a company named HCL Technologies, and the documentation around the package can found here: Help - HCL Informix V14.10 documentation (hcldoc.com).

    I hope this information is useful. 


    ------------------------------
    Loyd Vest
    ------------------------------