Setting DB2 UDB Environment Variables

For UNIX and Linux, the DB2 UDB installation provides two scripts for setting up the DB2 UDB environment variables: db2cshrc for C shell and db2profile for Bourne or Korn shell.

These scripts set the library path environment variable based on the bit size of the installed server or client.

Note: On Windows, the installation automatically sets all necessary environment variables. If Replication Agent is installed on Solaris, AIX or HP Itanium, you must configure a 64-bit DB2 UDB server or client instance. Information in this topic pertains to configuring a 64-bit DB2 UDB server.

For UNIX platforms, the 32-bit and 64-bit versions of the driver and API libraries are located in $HOME/sqllib/lib32 and $HOME/sqllib/lib64, respectively, where $HOME is the home directory of the DB2 UDB instance owner. If Replication Agent is installed on AIX, Solaris, HP Itanium, or Linux platforms, the library path environment variable must point to the 64-bit libraries. For Windows, the library path environment variable must point to the 32-bit libraries.

To correctly set the DB2 UDB environment variables for Replication Agent, you may need to customize either db2cshrc or db2profile. However, make any changes to saved copies of the original scripts because the scripts may be changed when you apply a FixPak to the DB2 UDB server or client.

  1. Navigate to the DB2 UDB server or client sqllib directory, which is located in the database instance owner user home directory. For example:
    cd /db2home/db2inst1/sqllib
  2. Based on the type of UNIX shell you are using, create a copy of either the db2cshrc or db2profile script:
    • For C shell:

      cp db2cshrc mydb2cshrc
    • For Bourne or Korn shell:

      cp db2profile mydb2profile
  3. Edit the copy of the file you just created. Add a statement at the very end of the file that sets the platform-specific library path variable to point to the correct DB2 UDB libraries.
    • For C shell, in mydb2cshrc, add:

      # force 32-bit libraries
      setenv LD_LIBRARY_PATH $HOME/sqllib/lib32:$LD_LIBRARY_PATH

      where $HOME is the home directory of the DB2 UDB instance owner.

    • For Bourne or Korn shell, in mydb2profile, add:

      # force 32-bit libraries
      LD_LIBRARY_PATH=$HOME/sqllib/lib32:$LD_LIBRARY_PATH
      export LD_LIBRARY_PATH
  4. Before starting Replication Agent, always source your file, if you have customized it. Otherwise, source the original db2cshrc or db2profile script.