DB2 Version 9.7 for Linux, UNIX, and Windows

Configuring your development environment to build and run CLI and ODBC applications

You can run CLI and ODBC applications against a DB2® database server using the IBM® Data Server Client, the IBM Data Server Runtime Client, or the IBM Data Server Driver for ODBC and CLI. However, to compile CLI or ODBC applications, you need the IBM Data Server Client.

Procedure

In order for a CLI application to successfully access a DB2 database:

  1. Ensure the CLI/ODBC driver was installed during the DB2 client install.
  2. For the IBM Data Server Client and Runtime Client only: If the database is being accessed from a remote client, catalog the database and hostname of the machine the database is on.

    On Windows operating systems, you can use the CLI/ODBC Settings GUI to catalog the DB2 database.

  3. Optional: Explicitly bind the CLI/ODBC bind files to the database with the command:
    db2 bind ~/sqllib/bnd/@db2cli.lst blocking all sqlerror continue \
          messages cli.msg grant public

    On Windows operating systems, you can use the CLI/ODBC Settings GUI to bind the CLI/ODBC bind files to the database.

  4. Optional: Change the CLI/ODBC configuration keywords by editing the db2cli.ini file. For information about the location of the db2cli.ini file, see db2cli.ini initialization file.

    On Windows operating systems, you can use the CLI/ODBC Settings GUI to set the CLI/ODBC configuration keywords.

Results

Once you have completed the above steps, proceed to setting up your Windows CLI environment, or setting up your Linux or UNIX ODBC environment if you are running ODBC applications on Linux or UNIX.