简体   繁体   中英

DB2 connection from C#

I'm working on connecting to DB2 database from .NET (C#) using the .NET Service Provider IBM.DATA.DB2.dll (application is a web service which gets details from DB2 database). I have installed DB2 Runtime Client and configured the ODBC and the connection was successful.

When I try to open a DB2 Connection object in the .NET code, I get an error could not find DB2APP.dll . The dll is available in the DB2 Runtime Client Install Path, but it searches in the bin folder. (I copied it to local machine though it is not right) and it required a new file db2nmp.xml which is also available in runtime client install path but the application is looking under " /WebService ProjectFolder/msg/en_US/db2nmp.xml ". I copied that one also and I'm able to connect to DB2. (I clearly think it is not right)

My question is how to force .NET to look in the DB2 Runtime Client install folder instead of searching in the web service project folder? I have tried all possible ways but still could not find an answer. Please help !!!!!

We work with DB2, and the ISeries installation register the IDM.DATA.DB2 assemblies in the GAC. ( Global Assembly Cache ).

If you go to c:\\windows\\assembly you will see the registered assemblies and you should have them like this:

在此处输入图片说明

Using the IBM2.Data.Db2.Iseries reference should be enough to perform database jobs. It should find whatever reference needed registered in GAC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM