July 20, 2010

399 words 2 mins read

Error: SQL1159 Initialization error with DB2 .NET Data Provider, reason code 10, tokens 0.0.0, 9.7.0

This past weekend I spent way too much time with Jon while trying to get our new work machines setup. Normally most of the time is spent waiting for Visual Studio to install (seriously that thing takes forever), but not so this time. DB2 kept refusing to work and play well with others. Specifically the driver that .NET uses to communicate with, and thus began several hours of googling and downloading and installing.

Before installing anything more than just Visual Studio 2005 (and doing a build of course), I tried to login and got:

Could not load file or assembly 'IBM.Data.DB2, Version=9.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208' or one of its dependencies. The system cannot find the file specified.

This wasn’t surprising as I had not yet installed any DB2 drivers.

So then I went and installed what I thought was the correct bit (ibm_data_server_client_win32_V97.zip) and got:

SQL1159 Initialization error with DB2 .NET Data Provider, reason code 10, tokens 0.0.0, 9.7.0

After scouring the internet, I found a post informing me that on 64 bit machines, the install will falsely report it completed successfully and fails to update the machine.config. To resolve it advised adding the following:

to my existing file (C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG), since I’m on a 64 bit box, I also added it to the 64 bit version (C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG).

Did an iisreset, same error, more hair pulling. I downloaded various other things from IBM’s website all of which promised to hold the key. Eventually, I finally find that what I need is DB2 Express-C (db2exc_972_WIN_x86_64.zip). As soon as that got installed, things worked just peachy, and both machine.configs were properly updated.

Here’s my big complaint: when I went and looked at an existing working dev environment (my desktop), Add/Remove Programs said only “IBM Data Server Client — DB2COPY1”, which is exactly what the other programs I installed said. So each time I spent hours looking for some possible setting that was missing, only to find there was no mythical setting, IBM just couldn’t be bothered to put in different names for their installed products. If the Add/Remove Programs entry had instead included “Express-C”, I could have gotten both machines installed with their dev environments ready to go in under an hour. Fortunately, on the new installs, it appears that there is now an entry for this item, so if I ever manage to forget all this, I will know what I need.