问题描述
我正在尝试使用 C# 应用程序连接到 IBM DB2 数据库.起初我安装了 IBM Data Server Driver Package
,根据 文档 适用于使用 ODBC、CLI、.NET、OLE 的应用程序DB、PHP、Ruby、JDBC 或 SQLJ,使用 IBM 数据服务器驱动程序包.然后我想我可以使用 IBM.Data.DB2
程序集并愉快地连接.它根本不起作用,因为应用程序在其当前工作目录中查找 db2app.dll
时不断崩溃.
I'm trying to connect to IBM DB2 database with C# application. At first I've installed IBM Data Server Driver Package
, which, according to the documentation is for applications using ODBC, CLI, .NET, OLE DB, PHP, Ruby, JDBC, or SQLJ, use IBM Data Server Driver Package. Then I thought I could use IBM.Data.DB2
assembly and happily connect. It didn't work at all, as the app kept crashing while looking for db2app.dll
in its current working directory.
然后我安装了IBM Data Server Client
,它在bin"目录中有这个dll,我将它添加到系统路径中.这没有帮助,所以我将它复制到我的应用程序的构建目录中,它现在可以工作了.但我认为这不正确,因为我还必须将 msgen_USdb2nmp.xml
文件复制到我的构建目录以获取异常错误文本.
Then I installed IBM Data Server Client
, which has this dll in "bin" directory, which I added to system path. That didn't help, so I copied it to my app's build directory, and it now works. But I don't think that is correct, as I also had to copy msgen_USdb2nmp.xml
file to my build directory to get exception error texts.
我认为从 DB2 安装中复制所有这些文件是错误的,我应该能够以某种方式强制 IBM.Data.DB2
程序集在系统路径中查找其所需文件,而不是在它的工作目录.我也认为 Data Server Driver Package
应该足够了,但是在我安装了更大的 之前,我无法对
.IBM.Data.DB2.dll
做任何事情>数据服务器客户端
I think it's wrong to copy all these files from DB2 installation, and I should somehow be able to force IBM.Data.DB2
assembly to look for its required files in the system path, not in its working directory. I also think that Data Server Driver Package
should be enough, but I wasn't able to do anything with IBM.Data.DB2.dll
until I installed the larger Data Server Client
.
我认为问题出在我自己身上,而不是 IBM,所以我做的事情明显或微妙地错误.
I assume that the problem is on my end, not with IBM, so I'm doing something obviously or subtly wrong.
我的问题是:如何将较小的 IBM Data Server Driver Package
与 .NET 应用程序一起使用?
My question is: How do I use the smaller IBM Data Server Driver Package
with .NET application?
推荐答案
我认为您正在寻找 DB2 手册中提供的以下信息:http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.swg.im.dbclient.adonet.doc/doc/c0010960.html
I think you are looking for this information that is available in DB2 manual: http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.swg.im.dbclient.adonet.doc/doc/c0010960.html
也许这也有帮助:http://www.ibm.com/developerworks/wikis/display/DB2/DB2%20and%20.NET%20FAQs#DB2and.NETFAQs-WherecanIfindtheDB2.NETproviderandVSAddins%3F
一般来说,我认为您应该从这里安装 IBM Database Add-Ins for Visual Studio(需要 IBM 注册):https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=swg-daivs
In general, I think you should've installed IBM Database Add-Ins for Visual Studio from here(Requires IBM Registration): https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=swg-daivs
这篇关于IBM db2 驱动部署/安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!