问题描述
我正在使用 nuget 包 IBM.Data.DB2.Core 版本 3.1.0.400 从带有 Azure Functions 版本 v3 (Windows) 的 Azure 函数连接到 IBM DB2 数据库.应用程序构建成功.
在本地执行它时,我面临以下异常.
IBM.Data.DB2.Core.DB2Exception (0x80004005): ERROR [] [IBM][CLI Driver] SQL10007N 消息0"无法检索.原因代码:6".在 IBM.Data.DB2.Core.ConnSettingsFromXmlConfig.ProcessFromXmlConfig(DB2Connection 连接、字符串 dbname、字符串主机、字符串端口、字符串 tmpClientEncAlg、字符串 tmpAuthentication、字符串 prevdb、字符串 prevdb_ori、DB2ConnSettings& sSettings、DB2ConnSettingsInternal& sSettingsInternal、StringBuilder& modifiedValue)在 IBM.Data.DB2.Core.DB2ConnPool.ReplaceConnectionStringParms(DB2Connection 连接,字符串 szValue,DB2ConnSettings 和 pSettings,DB2ConnSettingsInternal 和 pSettingsInternal,布尔 bAttach,布尔 pushDownStrAppended)在 IBM.Data.DB2.Core.DB2Connection.set_ConnectionString(字符串值)在 IBM.Data.DB2.Core.DB2Connection..ctor(字符串 connectionString)
这是代码片段,在实例化 DB2Connection 时,我遇到了异常.
使用 (var db2Connection = new DB2Connection(_configuration["DB2_ConnectionString"])){db2Connection.SystemNaming = true;
请注意.此代码在我能够连接到 DB2 的控制台应用程序中运行良好.
谢谢大家.
Azure 函数支持目前在 Db2 .NET 中不可用提供者.它将在即将发布的 .NET 5 和.NET Core 3.1.
看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%26>
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.
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
这篇关于无法连接到 DB2:Azure 函数上的 IBM.Data.DB2.Core 版本 3.1.0.400的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!