Configuring environment variables for the IBM Data Server Driver for ODBC and CLI

The IBM Data Server Driver for ODBC and CLI is not part of the IBM Data Server Client or the IBM Data Server Runtime Client. It must be installed and configured separately. To use the IBM Data Server Driver for ODBC and CLI, there are two types of environment variables that you might have to set: environment variables that have replaced some Db2® registry variables; and an environment variable that tells your applications where to find the driver libraries.

Before you begin

To configure environment variables for the IBM Data Server Driver for ODBC and CLI, you need one or more copies of the driver installed. See Installing the IBM Data Server Driver for ODBC and CLI software on Linux and UNIX operating systems.


Restrictions

If there are multiple versions of the IBM Data Server Driver for ODBC and CLI installed on the same machine, or if there are other Db2 Version 9 products installed on the same machine, setting environment variables (for example, setting LIBPATH or LD_LIBRARY_PATH to point to the IBM Data Server Driver for ODBC and CLI library) might break existing applications. When setting an environment variable, ensure that it is appropriate for all applications running in the scope of that environment.

IBM Data Server Driver for ODBC and CLI on 64 bit UNIX and Linux® systems also packages 32 bit driver library to support 32 bit CLI applications. On UNIX and Linux systems, you can associate either 32 bit or 64 bit libraries with an instance, not both. You can set LIBPATH or LD_LIBRARY_PATH to either lib32 or lib64 library directories of IBM Data Server Driver for ODBC and CLI. You can also access lib64 library using a preset soft link from the lib directory. The IBM Data Server Driver for ODBC and CLI on Windows systems contains both 32 bit and 64 bit necessary runtime DLLs in the same bin directory.

Procedure

To configure environment variables for the IBM Data Server Driver for ODBC and CLI:

  1. Optional: Set any applicable Db2 environment variables corresponding to its equivalent Db2 registry variables.

    There is no support for the command line processor (CLP) with the IBM Data Server Driver for ODBC and CLI. For this reason, you cannot configure Db2 registry variables using the db2set CLP command. Required Db2 registry variables have been replaced with environment variables.

    For more information about Db2 registry variables, see: Db2 registry and environment variables.

    For a list of the environment variables that can be used instead of Db2 registry variables, see: Environment variables supported by the IBM Data Server Driver for ODBC and CLI.

  2. Optional: You can set the local environment variable DB2_CLI_DRIVER_INSTALL_PATH to the directory in which the driver is installed.

    If there are multiple copies of the IBM Data Server Driver for ODBC and CLI installed, ensure that the DB2_CLI_DRIVER_INSTALL_PATH points to the intended copy of the driver. Setting the DB2_CLI_DRIVER_INSTALL_PATH variable forces IBM Data Server Driver for ODBC and CLI to use the directory specified with the DB2_CLI_DRIVER_INSTALL_PATH variable as the install location of the driver.

    For example:
    export DB2_CLI_DRIVER_INSTALL_PATH=/home/db2inst1/db2clidriver/clidriver 
    where /home/db2inst1/db2clidriver is the install path where the CLI driver is installed
  3. Optional: Set the environment variable LIBPATH (on AIX® operating systems), or LD_LIBRARY_PATH (on rest of the UNIX and Linux systems) to the lib directory in which the driver is installed.
    For example (on AIX systems):
    export LIBPATH=/home/db2inst1/db2clidriver/clidriver/lib

    If there are multiple copies of the IBM Data Server Driver for ODBC and CLI installed, ensure LIBPATH or LD_LIBRARY_PATH points to the intended copy of the driver. Do not set LIBPATH or LD_LIBRARY_PATH variables to multiple copies of the IBM Data Server Driver for ODBC and CLI that are installed on your system. Do not set LIBPATH or LD_LIBRARY_PATH variables to both lib32 and lib64 (or lib) library directories.

    This step is not necessary if your applications statically link to, or dynamically load the driver library (db2cli.dll on Windows systems, or libdb2.a on other systems) with the fully qualified name.

    You must dynamically load the library using the fully qualified library name. On Windows operating systems, you must use the LoadLibraryEx method specifying the LOAD_WITH_ALTERED_SEARCH_PATH parameter and the path to the driver DLL.

  4. Optional: Set the PATH environment variable to include the bin directory of the driver installation in all systems if you require the use of utilities like db2level, db2cli, and db2trc. In UNIX and Linux systems, add adm directory of the driver installation to the PATH environment variable in addition to the bin directory.
    For Example (on all UNIX and Linux systems) :
    export PATH=/home/db2inst1/db2clidriver/clidriver/bin:/home/db2inst1/db2clidriver/clidriver/adm:$PATH