I’m sure this is a very niche article. Which means if you’ve arrived here, you’ve almost certainly been as frustrated as I have with the documentation for DB2 ODBC connections.
Background: I’m trying to connect to a DB2 instance, running on a Windows machine. I imagine that this procedure will work just as well for instances running on other architectures. And I’m trying to connect from another Windows machine, to pass data into a Microsoft SQL-powered data warehouse.
You will need the “IBM Data Server Driver for ODBC and CLI (Windows/x86-32 32 bit) V10.5 Fix Pack 8“. If the link doesn’t work any more, go to IBM Fix Central and search for “Windows Data Server Driver ODBC 10.5”. Possibly other versions will work, but this is the one I found most reliable.
The process is as follows:
- Copy the entire extracted folder to the root of a data drive (e.g. to D:\DB2, E:\DB2 as the case may be).
- Add the bin folder to the computer’s PATH environment variable (DB2\clidriver\bin).
- Launch an elevated command prompt.
- Navigate to the DB2 bin folder. E.g.:
- Install the ODBC driver:
- On Windows Server 2012 R2, also run:
- The driver will now appear in the 32-bit ODBC driver list:
- Launch the 32-bit ODBC data source administration applet.
- On the User DSN or System DSN tab, click Add.
- Select the ODBC driver and click Finish.
- Name the data source (e.g. “CSM”, in my case) and then click “Add”, next to the Database alias dropdown.
- Enter User ID and password.
- Check the “Save password” box. Note the warning and click OK.
- Switch to the Advanced Settings tab.
- Use the “Add” button, to enter the following values.
Hostname: [host DNS name or IP address] Port: 50000 Protocol: TCP/IP Database: [DB name, e.g. CTI_DATA]
- Review the settings and click OK:
- To test the connection, first click the “Configure” button.
- The credentials are stored in the ini file, so you do not need to enter them here. Simply click “Connect”.
- You should see a success message.
If you’re looking for a free, Windows-based ODBC interrogation program, there are a few out there. All the ones I tried had quirks in their interfaces. I’ve had most success with ODBC query tool though. Here it is, running under Windows 10:
If that doesn’t work for you, you can try the almost identically named ODBC QueryTool.
2 Replies to “How-to: ODBC connection to DB2 instance (e.g. Mitel CSM)”
Thanks for the very niche article. Yes, I also needed to connect to a Mitel CSM DB2 instance to get the data into a SQL Server.
This just shows it’s ALWAYS worth posting that niche article – somebody is bound to need it some day!
Great to know!