Cannot connect to DB2: IBM.Data.DB2.Core version on Azure Function


I'm using nuget package IBM.Data.DB2.Core version to connect to IBM DB2 database from Azure functions with Azure Functions Version v3 (Windows). Application builds successfully.

While executing it locally itself, I am facing following exception.

IBM.Data.DB2.Core.DB2Exception (0x80004005): ERROR [] [IBM][CLI Driver] SQL10007N Message "0" could not be retrieved.  Reason code: "6".

   at IBM.Data.DB2.Core.ConnSettingsFromXmlConfig.ProcessFromXmlConfig(DB2Connection connection, String dbname, String host, String port, String tmpClientEncAlg, String tmpAuthentication, String prevdb, String prevdb_ori, DB2ConnSettings& sSettings, DB2ConnSettingsInternal& sSettingsInternal, StringBuilder& modifiedValue)
   at IBM.Data.DB2.Core.DB2ConnPool.ReplaceConnectionStringParms(DB2Connection connection, String szValue, DB2ConnSettings& pSettings, DB2ConnSettingsInternal& pSettingsInternal, Boolean bAttach, Boolean pushDownStrAppended)
   at IBM.Data.DB2.Core.DB2Connection.set_ConnectionString(String value)
   at IBM.Data.DB2.Core.DB2Connection..ctor(String connectionString)

Here's the code snippet, where at the time of instantiating the DB2Connection I am getting above exception.

using (var db2Connection = new DB2Connection(_configuration["DB2_ConnectionString"]))
     db2Connection.SystemNaming = true;

Please note. This code works well as console application where I am able to connect to DB2.

Thank you all.

asked on Stack Overflow May 13, 2021 by Deepak

1 Answer


User contributions licensed under CC BY-SA 3.0