0

I'm using nuget package IBM.Data.DB2.Core version 3.1.0.400 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.

Deepak
  • 428
  • 5
  • 12
  • I am not able to connect to DB2, getting the same error in the link below. Do you know how to fix the connection problem? https://stackoverflow.com/questions/47147121/asp-net-core-2-0-web-app-fails-to-connect-to-db2-on-system-i – Niang Moore Feb 24 '22 at 18:35

1 Answers1

1

the Azure functions support is currently not available in Db2 .NET provider. It will be available in the upcoming release of .NET 5 and .NET Core 3.1.

See https://community.ibm.com/community/user/hybriddatamanagement/communities/community-home/digestviewer/viewthread?GroupId=6163&MessageKey=2494b111-ffe7-4073-a8ec-e7e1c485e6d0&CommunityKey=f2e5dc34-896d-4e8e-9678-724907c4b9f5&tab=digestviewer&ReturnUrl=%2fcommunity%2fuser%2fhybriddatamanagement%2fcommunities%2fcommunity-home%2fdigestviewer%3fcommunitykey%3df2e5dc34-896d-4e8e-9678-724907c4b9f5%26tab%3ddigestviewer

mao
  • 11,321
  • 2
  • 13
  • 29
  • Thanks @mao for your quick response, I have been to this post. But I have found several other questions/post where people were facing other errors as well, so I believe few people has made this working with Azure Functions so I asked this question in hope to find a solution. Thanks again. – Deepak May 13 '21 at 14:14
  • 1
    This specific error is usually environmental (and solvable), however if your company should need a production environment that is supported by the IBM support channel for Db2 then you might not want to hack things, before "official" support is ready. But if it's for non production or you don't need IBM support then get busy trying... – mao May 13 '21 at 14:17
  • Hi @mao, yeah I am hopeful as people have figure out a solution to make it work on Azure Function. look at this question: https://stackoverflow.com/questions/60458243/ibm-data-db2-core-throws-exception-in-azure-function-app, I have already posted my comment here too for any possible solution. – Deepak May 13 '21 at 14:23