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.
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 msg\en_US\db2nmp.xml
file to my build directory to get exception error texts.
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
.
I assume that the problem is on my end, not with IBM, so I'm doing something obviously or subtly wrong.
My question is: How do I use the smaller IBM Data Server Driver Package
with .NET application?