IBM.Data.DB2.Core连接问题 [英] IBM.Data.DB2.Core connection problems

查看:155
本文介绍了IBM.Data.DB2.Core连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

连接到DB2时,我总是收到错误消息.但仅适用于已部署(msi打包或单击一次)的应用程序.(并且在同一台计算机上)

在Visual Studio 2017中运行应用程序时,无论是调试版本还是发行版,一切都完美运行.

我正在Windows 10上使用nuget的1.3.0.100版本的库

我还在使用服务器的免费社区版本,这是Win Server 2012 r2上的最新下载安装.

有什么想法吗?这显然是在IBM代码内部...

我知道这没什么大不了的,但是希望有人以前遇到过这个问题.

下面的堆栈:

  System.ArgumentOutOfRangeException:长度不能小于零.参数名称:长度在IBM.Data.DB2.Core.DB2ConnPool.Open(DB2Connection连接,String& szConnectionString,DB2ConnSettings& ppSettings,Object& ppConn)中在IBM.Data.DB2.Core.DB2Connection.Open()在FrozenElephant.Symbiotic.DataProviderDB2.DatabaseTypesFactoryDB2.CreateConnection()在FormDatabaseConnection.btnTestConnection_Click(Object sender,EventArgs e) 

解决方案

以答案的形式总结上面的发现,因为一段时间后我可能不会再详细说明我的评论.

看来,此问题不是由代码错误引起的,而是由DB2连接器在失败的目标机器上的配置或者可能是应用程序的部署方式导致的.通过查看连接器的可重新分发部分的部署方式,可以确定是哪一个罪魁祸首.

然后,您可能需要检查显示所有文件"以确认部署中每个文件的状态:

I keep getting a error when connecting to DB2. But only on the deployed (msi packaged or click-once) app. (And on the same Machine)

Everything works perfectly when running the app from Visual Studio 2017. in either debug or release builds.

I'm using libs from nuget for version 1.3.0.100 on windows 10

I'm also using the free community version of the server, a recent download install on win server 2012 r2.

Any idea whats going on? This obviously inside IBM code...

I know this is not much to go on, but hoping someone has ran into this problem before.

Stack Below:

System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
   at IBM.Data.DB2.Core.DB2ConnPool.Open(DB2Connection connection, String& szConnectionString, DB2ConnSettings& ppSettings, Object& ppConn)
   at IBM.Data.DB2.Core.DB2Connection.Open()
   at FrozenElephant.Symbiotic.DataProviderDB2.DatabaseTypesFactoryDB2.CreateConnection()
   at FormDatabaseConnection.btnTestConnection_Click(Object sender, EventArgs e) 

解决方案

Summarizing the findings above in the form of an answer, since I may not get back to elaborate on my comments for a while.

It appears that this problem is the result not of a code error, but of the disposition of the DB2 connector on the target machine that fails, or perhaps in how the application is deployed. Deciding which is the culprit will need to be done by looking at how the redistributable parts of the connector are deployed.

One user said that he "was not referencing the assemblies correctly in my application". A few possibilities this might indicate include:

  • A different version of the SDK is used for development compared to what is on the target machine
  • Perhaps multiple different assemblies of conflicting version or origin have been mixed
  • The assemblies may need to be deployed with the application, and not all are. This could be fixed by setting Copy Local = true for the relevant assemblies.
  • It might also be that the application is being compiled for a different platform than the client installed on the target machine (say, x64 version x86).

Another person mentions the same error message arising from a similar, but slightly different, cause. This one says "It seems to be an installation issue. Some files are not found."

In this case, you would probably be looking at reinstalling the client or diagnosing the install in another way. The second link above mentions a tool, testconn20, which may be available in the client you have installed. Your connection string might also offer some hints; if there's anything in it which might depend on the specific client you have installed, or its capabilities, that'd be another place to check.

Edit:

Per my comment below, you may be missing some files or folders from the ClickOnce deployment. If you determine that the clidriver folder, which has DB2-related files in it, is necessary for the application to function properly, you should check the build action, copy to output directory, and ClickOnce application files settings. The last one may be key. To check that, go to Publish in the project properties:

Then you may need to check "Show all files" to confirm the status of each file in the deployment:

这篇关于IBM.Data.DB2.Core连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆