Setting IBM DB2 Universal Database Environment Variables

Set the IBM DB2 Universal Database environment variables.

For UNIX and Linux, the IBM DB2 Universal Database installation provides two scripts for setting up the IBM DB2 Universal Database 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 sets all necessary environment variables.

For UNIX and Linux 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 IBM DB2 Universal Database instance owner. If Replication Agent is installed on AIX, Solaris, or HP Itanium, the library path environment variable must point to the 64-bit libraries. For all other platforms, the library path environment variable must point to the 32-bit libraries.

Note:

If Replication Agent is installed on Solaris, AIX or HP Itanium, you must configure a 64-bit IBM DB2 Universal Database server or client instance.

To correctly set the IBM DB2 Universal Database environment variables for Replication Agent and ECDA, 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 IBM DB2 Universal Database server or client.

Note:

Replication Agent requires 32-bit libraries for Linux and Windows and 64-bit libraries for UNIX. Because ECDA may have different requirements, you may want to maintain two separate customized copies of the aforementioned scripts, one copy for Replication Agent and one for ECDA.

  1. Navigate to the IBM DB2 Universal Database 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, copy either the db2cshrc or db2profile script:
    • For C shell:

      cp db2cshrc mydb2cshrc
    • For Bourne or Korn shell:

      cp db2profile mydb2profile
  3. Edit your copy of the file. Add a statement at the very end of the file that sets the platform-specific library path variable to point to the 32-bit IBM DB2 Universal Database libraries. For example, on Solaris or Linux, add these lines:
    • For C shell, in mydb2cshrc:

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

      where $HOME is the home directory of the IBM DB2 Universal database instance owner.

    • For Bourne or Korn shell, in mydb2profile:

      # force 32-bit libraries
      LD_LIBRARY_PATH=$HOME/sqllib/lib32:$LD_LIBRARY_PATH
      export LD_LIBRARY_PATH
  4. Before starting either Replication Agent or ECDA, always source your file, if you have customized it. Otherwise, source the original db2cshrc or db2profile script.
Related concepts
Node and Database Cataloging in an IBM DB2 Universal Database Client