Linux and UNIX environment variable settings

Depending on the operating system, values for the environment variables are set, either in the db2profile file (for the Bash or Korn shell) or the db2cshrc file (for the C shell).

Calls to db2profile or db2cshrc files are put in the instance owner's .bashrc (Bash shell) file and either in the .profile (Bash or Korn shell) file or in the .login (C shell) file.

AIX® operating systems:
  • PATH, includes several Db2® directories including sqllib/bin
  • LIBPATH, includes the sqllib/lib directory
Linux® operating systems:
  • PATH, includes several Db2 directories including sqllib/bin
  • LD_LIBRARY_PATH, includes the sqllib/lib directory

Empty sqllib/userprofile and sqllib/usercshrc files are created during instance creation. You can place your own instance environment settings into these files. If you do not want the new environment settings in the db2profile or db2cshrc script, you can override them using the corresponding user script, which is called at the end of the db2profile or db2cshrc script. During an instance upgrade, which you perform by using the db2iupgrade command, the user scripts are copied so that your environment modifications are still in use.

You can generate the db2profile file (for the Born and Korn shell) and the db2cshrc file (for the C shell) from a IBM® Data Server Driver Package or IBM Data Server Driver for ODBC and CLI installation by using the installDSDriver command. Running the db2profile or db2cshrc shell script file sets the environment variables as shown in the following list:
  • Generic PATH and library path settings.
    export PATH=INSTALL_PATH/bin:$PATH
    Setting library path on AIX operating systems:
    export LIBPATH=INSTALL_PATH/lib:$LIBPATH
    Setting the library path on other UNIX operating systems and Linux operating systems:
    export LD_LIBRARY_PATH=INSTALL_PATH/lib:$LD_LIBRARY_PATH
  • Environment variables to be used by open source drivers.
    export IBM_DB_DIR=INSTALL_PATH
    export IBM_DB_LIB=INSTALL_PATH/lib
    export IBM_DB_INCLUDE=INSTALL_PATH/include
    export DB2_HOME=INSTALL_PATH
    export DB2LIB=INSTALL_PATH/lib
  • Environment variables to be used by SQLJ, JDBC, and JCC drivers.
    export CLASSPATH=INSTALL_PATH/java/db2jcc.jar:$CLASSPATH
    export CLASSPATH=INSTALL_PATH/java/sqlj.zip:$CLASSPATH
  • Environment variables to be used by CLPPlus utility.
    export CLASSPATH=INSTALL_PATH/tools/clpplus.jar:$CLASSPATH
    export CLASSPATH=INSTALL_PATH/tools/jline-0.9.93.jar:$CLASSPATH
    export CLASSPATH=INSTALL_PATH/tools/antlr-3.2.jar:$CLASSPATH