I had a lot of trouble with connecting to DB2 on Windows. I thought it was hard to figure out the right connection string, and there is also a bug that led me on the wrong track.
I had DB2 installed on the same virtual server as BizTalk, and used this connection string:
Provider=DB2OLEDB;Network Transport Library=TCPIP;Network Address=localhost;Network Port=50000;Initial Catalog=SAMPLE;Package Collection=db2admin;User ID=db2admin;Password=pass@word1;
I got the following error message:
Message: The network connection was terminated because the host failed to send any data.
Native error: –605
Source: Microsoft DB2 OLE DB Provider
This was regardless if I used the Data Access Tool or .net code. Using IBM’s OLE DB provider from .net code worked well:
It turned out that you cannot use localhost with the Microsoft DB2 OLE DB provider! When I changed to 127.0.0.1 it worked. The real host name works as well.
Next problem was the parameters in the connection string. I wanted to use the sample database that I created using IBM’s setup program. I was logged in as Administrator during this installation, so the sample database objects were created in the Administrator schema. This configuration worked:
Note that you should specify the database in “Initial catalog” on in “Database name”.