Installing and configuring an DB2 ODBC CLI-driver on Windows

An DB2 CLI-driver is a self-sufficient driver that supports a subset of the functions that are provided by the DB2 ODBC-driver.

First download the DB2 ODBC CLI-driver from IBM’s homepage. As such you don’t need to install the driver. You just need to copy it to the location where you want it to reside.
In the below example the directory for the driver is: C:\Software\DB2_ODBC\
The file downloaded from the IBM-homepage is then unpacked into the directory v10.5fp11_nt32_odbc_cli

When the driver is unpacked go to the directory bin. In this directory you need to execute the command db2cli install -setup. This installs/makes the driver visible inside ODBC Data Sources in Windows.

Now you need to create or copy an existing db2cli.ini file to the directory (in this example): C:\Software\DB2_ODBC\v10.5fp11_nt32_odbc_cli\clidriver

Below is an example of what the contents of an db2cli.ini file could be. The db2cli.ini file is “just” a file containing meta-information about the alias that you want to use for you driver inside ODBC Data Sources in Windows.

Now you need to create or copy an existing file db2dsdriver.cfg. This file is to be placed in the directory (in this example): C:\Software\DB2_ODBC\v10.5fp11_nt32_odbc_cli\clidriver\cfg

Below is an example of what the contents of an db2dsdriver.cfg file could be. The db2dsdriver.cfg file contains the more technical information about the alias that you created in the db2cli.ini file. Therefore, the alias in this file must correspond to an alias in the db2cli.ini file. Pointing the alias in the db2cli.ini file to a server and database.

NB! The port number (port=”50000”) in the example below doesn’t have to be the port number used on your system. This is just the default port number for an DB2-instance.

SSIS and IBM DB2 – Don’t do it!

SSIS is a product that should be indifferent to whatever RDBMS you use. That’s also true. It will work with every RDBMS through drivers ODBC, OLE DB, ADO.NET etc. BUT it works best with Microsofts SQL-server.

This blogpost will take a look at using IBM DB2 with SSIS. Below is a test using ODBC-driver for IBM DB2 from IBM, OLE DB for IBM DB2 from Microsoft and an ADO.NET-driver.

Transfer rate of data

Transferring 100.000 rows from one IBM DB2-server to another IBM DB2-server.

OLE DB-driver for IBM DB2 from Microsoft 6 minuts
ADO.NET-driver 30 seconds
ODBC-driver for IBM DB2 from IBM 5 seconds

As seen above the ODBC-driver for IBM DB2 from IBM is the best solution when it comes to transfer rate. The OLE DB-driver for IBM DB2 from Microsoft is a really poor choice. But using the ODBC-driver for DB2 from IBM is not the solution to everything!

Lookup-task in SSIS

As seen in the picture below it’s only possible to use an OLE DB-connection in the Lookup-task. The Lookup-task is really slow and it might be better doing it in SQL. Regarding a lot of the tasks in SSIS, they are really slow (see links below).

OLE DB Command

SSIS also contains a ‘OLE DB Command’-task and no ‘ODBC Command’-task.

Fast load/Bulk load

OLE DB
It’s NOT possible to use the fast load option with the OLE DB-driver when it comes to IBM DB2. It’s possible to choose the fastload option, but you will get the error below.

The reason why the OLE DB-driver is that slow is probably that it transfers one row at a time.

ODBC
It’s possible to use a batch/fast load load option in ODBC.

ADO.NET
It’s also possible to use a bulk/fast load option in ADO.NET.

Links

The links below is to different sources that can help you with SSIS.

SQL Server Integration Services Design Patterns
A book that describes different design pattern for SSIS.

Task Factory for SSIS from Pragmatic Works
A collection of optimized SSIS-tasks.

Cozyroc
A collection of optimized SSIS-tasks.

PragmaticWorks free online training videos
Free online training videos about SSIS (search for SSIS).

Pluralsight
Online training videos in SSIS (requires a paid subscription to Pluralsight).