Connection String for DB2 on Windows

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
SQLState: 08S01

This was regardless if I used the Data Access Tool or .net code. Using IBM’s OLE DB provider from .net code worked well:

Provider=IBMDADB2;Database=SAMPLE;Hostname=localhost;Protocol=TCPIP; Port=50000;Uid=db2admin;Pwd=pass@word1;

It turned out that you cannot use localhost with the Microsoft DB2 OLE DB provider! When I changed to 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”.


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.