我在连接到 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(对象发送者,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:
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 连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!