Monday, March 19, 2012

IBM DB2: using db2 providers for .NET

I was creating a tool to automate test data creation on db2 database, at the beginning I faced lot’ s of issues to be able to use the IBM DB2 .NET drivers. I have 64 bit OS, when I installed 32 bit client, can be downloaded from here, using the IBM.Data.DB2 was giving initialization errors, even if the target for my tool is x86, it was giving problems

errors I was getting:

SQL1159 Initialization error with DB2 .NET Data Provider, reason code 7, tokens 9.5.0.DEF.2, SOFTWARE\IBM\DB2\InstalledCopies

I then removed the 32  bit version and installed the 64 bit version, can be downloaded from here , this also was giving errors since the target is x86, I guess it was looking for the 32 bit DB2 dlls.

error I was getting

Could not load file or assembly 'IBM.Data.DB2, Version=, Culture=neutral, PublicKeyToken=7c307b91aa13d208' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Finally, I kept both the the 32 bit and the 64 bit, this worked perfectly, and set the target to x86, when I deployed my application to my colleagues having them installed 32 bit IBM Data Server Driver Package on their 32 bit operating systems, it worked perfectly.


  1. I've read that DB2 Connect licenses are required to use the DB2 .NET data provider to connect to UDB on an iSeries or zSeries. Is this correct? If so, what about the ODBC driver included with IBM's Client Access for Windows? Can IBM's client access software be installed on a Windows 2008 R2 web or app server to connect to UDB on an iSeries v6r1 or v7r1 without any additional licensing requirements? I'm new to the whole iSeries and DB2 thing, the information on IBM's website is very vague and confusing.

  2. I believe you need the licences for the DB2 servers, no licence required for using the connectors.
    I tried using the ODBC, OLE, my opinion is that using the DB2 .NET Data providers is better
    check these links for more details