Error:SQL1159 Initialization error with DB2.NET Data Provider, reason Code 10

Update – 12-01-2010-  If you are running DB 9.7.2 you no longer need to do the following.  IBM has added the ability to connect 64 and 32 bit apps to a single client with Fix Pack 3.  Follow the links below for information.

http://www-01.ibm.com/support/docview.wss?uid=swg24028317

http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14552668

So I ran into this error this week on our Server 2008 R2. So after a few days of troubleshooting I did find where the issue was. It appears that on 64 bit OS’s during installation of the DB2 32 bit client calls machine.config incorrectly.

So to fix this, you need to update machine.config manually.

1. Open machine.config in a text editor (notepad ++) as administrator

    For .NET 2.0 to 3.5

  • C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
    For .NET 4.0

  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\CONFIG\machine.config

2. Add the following lines to <DbProviderFactories> of course correct for the version you are using. For this example I am using IBM DB2 .NET Data Provider 9.7.0

<add name=”IBM DB2 .NET Data Provider” invariant=”IBM.Data.DB2″ description=”IBM DB2 Data Provider for .NET Framework 2.0″ type=”IBM.Data.DB2.DB2Factory, IBM.Data.DB2, Version=9.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208″/><add name=”IBM Informix .NET Data Provider” invariant=”IBM.Data.Informix” description=”IBM Informix Data Provider for .NET Framework 2.0″ type=”IBM.Data.Informix.IfxFactory, IBM.Data.Informix, Version=9.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208″/><add name=”IBM DB2 .NET Data Provider 9.7.0″ invariant=”IBM.Data.DB2.9.7.0″ description=”IBM DB2 Data Provider 9.7.0 for .NET Framework 2.0″ type=”IBM.Data.DB2.DB2Factory, IBM.Data.DB2.9.7.0, Version=9.7.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208″/><add name=”IBM Informix .NET Data Provider 9.7.0″ invariant=”IBM.Data.Informix.9.7.0″ description=”IBM Informix Data Provider 9.7.0 for .NET Framework 2.0″ type=”IBM.Data.Informix.IfxFactory, IBM.Data.Informix.9.7.0, Version=9.7.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208″/>

3. Verify that you have IBM.Data.DB2 listed in <runtime> if not add the following. Again modify to the version you are installing

<runtime><assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″><dependentAssembly><assemblyIdentity name=”IBM.Data.DB2″ publicKeyToken=”7c307b91aa13d208″ culture=””/><bindingRedirect oldVersion=”8.1.2.0″ newVersion=”9.0.0.2″/><bindingRedirect oldVersion=”8.1.2.1″ newVersion=”9.0.0.2″/><bindingRedirect oldVersion=”9.0.0.1″ newVersion=”9.0.0.2″/></dependentAssembly><dependentAssembly><assemblyIdentity name=”IBM.Data.Informix” publicKeyToken=”7c307b91aa13d208″ culture=””/><bindingRedirect oldVersion=”3.0.0.2″ newVersion=”9.0.0.2″/><bindingRedirect oldVersion=”2.81.0.0″ newVersion=”9.0.0.2″/><bindingRedirect oldVersion=”9.0.0.1″ newVersion=”9.0.0.2″/></dependentAssembly><dependentAssembly><assemblyIdentity name=”IBM.Data.DB2.9.7.0″ publicKeyToken=”7c307b91aa13d208″ culture=””/><bindingRedirect oldVersion=”9.7.0.1″ newVersion=”9.7.0.2″/><codeBase version=”9.7.0.2″ href=”C:\Program Files\IBM\SQLLIB\bin\netf20\specific\IBM.Data.DB2.9.7.0.dll”/></dependentAssembly><dependentAssembly><assemblyIdentity name=”IBM.Data.Informix.9.7.0″ publicKeyToken=”7c307b91aa13d208″ culture=””/><codeBase version=”9.7.0.2″ href=”C:\Program Files\IBM\SQLLIB\bin\netf20\specific\IBM.Data.Informix.9.7.0.dll”/></dependentAssembly></assemblyBinding></runtime>

4. After that save, reboot and things should start working.

Advertisements
This entry was posted in Database and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s