DB2 ODBC Driver Getting Started Tutorial

This guide shows you how to download, install and license the DB2 ODBC driver.

At the end, you will be able to access your DB2 database using isql, an interactive SQL tool included in the ODBC driver distribution.

Step 1: What You Need To Know

Before you begin, contact your database administrator for the following information:

Step 2: Download the DB2 ODBC Driver Distribution

  1. Log in at http://www.easysoft.com.

    If you have not yet done so, you need to register first. On the registration form, an asterisk (*) indicates that a field is mandatory.

  2. Download the Easysoft ODBC-DB2 Driver distribution for your platform.
  3. Save the distribution file to a temporary directory on the machine where you want to install the DB2 ODBC driver.

Step 3: Install the DB2 ODBC Driver

Note You need root access on the machine where you want to install the DB2 ODBC driver.

  1. Log in to your client system and cd into the directory where you downloaded the DB2 ODBC driver distribution. For example:
    cd /tmp
  2. Unpack the distribution file:
    tar -xvf odbc-db2-version-platform.tar

    Replace version and platform with the version number and platform contained in the distribution file name.

  3. cd into the directory created by unpacking the distribution file.
  4. To start the installation, as root, type:
  5. Accept the default choices throughout the installation by pressing RETURN. To accept the terms of the Easysoft End User License Agreement, type Yes. At certain points in the installation, the installation script pauses to report its progress. To continue to the next stage, press RETURN.
  6. When prompted to choose a product to license, choose the DB2 ODBC driver by typing its option number.

    Next, you need to supply:

    1. Your full name
    2. Your company name
    3. An email contact address. This must be the email address you registered on the Easysoft web site.
    4. Your telephone number (you need to specify this if you telephone the license request to us).
    5. Your fax number (you need to specify this if you fax the license request to us).
    6. A reference number. When applying for a trial license just press ENTER. This field is used to enter a reference number we will supply you for full (paid) licenses.

    The License Client asks you to choose a method for obtaining the license. To obtain a license automatically, you need to be connected to the Internet and allow outgoing connections to license.easysoft.com on port 8884. If you are not connected to the Internet or do not allow outgoing connections through port 8884, the License Client can create a license request file which you can:

    1. Enter at http://www.easysoft.com/support/licensing/trial_license.html to obtain your license.
    2. Supply to Easysoft by mail, fax or telephone.

    If you choose option [2], the license request is written to a file named license_request.txt and you should exit the License Client (option [0]) and complete the installation. Once you have mailed, faxed or telephoned the license request to us, we will return a license key. Add this to the end of the file /usr/local/easysoft/license/licenses.

    At the end of the installation, you will have installed and licensed the DB2 ODBC driver, installed the unixODBC Driver Manager and created an ODBC data source.

  7. Set and export the LD_LIBRARY_PATH environment variable:
    export LD_LIBRARY_PATH

    Note On AIX, replace LD_LIBRARY_PATH with LIBPATH.

Step 4: Access an DB2 ODBC Driver Data Source

The DB2 ODBC driver installation creates a sample data source named DB2_SAMPLE that you can use as a starting point.

  1. As root, open /etc/odbc.ini in a text editor.
  2. To locate the sample data source, search for [DB2_SAMPLE].
  3. Change these attribute values:
    Attribute Value
    Server The host name (or IP address) of the machine where your DB2 instance is running.
    User The operating system user name to use when connecting to DB2. You must specify a name of a user who has access to the machine on which DB2 is running.
    Password The password for the user name specified by User.
    cd /usr/local/easysoft/unixODBC/bin
    ./isql.sh -v DB2_SAMPLE
  4. At the prompt, type a select statement or type help to display a list of tables. To exit, press RETURN in an empty prompt line.

What Next?

You are now ready to use the DB2 ODBC driver with your own applications and development tools on your UNIX/Linux DB2 client machine.

Further Support

Getting Started Feedback

* Did this content help you?
* Please select one option based on your first choice:

(* Required Fields)