Setting up the Db2 command line processor

You can use the Db2 command line processor to issue SQL statements, bind DBRMs that are stored in HFS files, and call stored procedures. The Db2 command line processor on Db2 for z/OS® is a Java™ application that runs under z/OS UNIX System Services.

Before you begin

Before you begin setting up the Db2 command line processor, ensure that your system has the following features:
  • Java 1.7 or later.
  • IBM® Data Server Driver for JDBC and SQLJ.

    For information on installing this feature, see Installing the IBM Data Server Driver for JDBC and SQLJ on Db2 for z/OS.

  • Db2 metadata stored procedures installed and authorized. To install and authorize the Db2 metadata stored procedures, run the installation job DSNTIJRT. To check if the Db2 metadata stored procedures were successfully installed and activated, run the validation job DSNTIJRV.

Procedure

To set up the Db2 command line processor, complete the following steps:

  1. Modify the CLASSPATH variable in your .profile file to include the clp.jar file.
    If you install the Db2 command line processor into the /usr/lpp/db2c10_base directory, you can issue the following command to modify your CLASSPATH variable:
    export CLASSPATH=$CLASSPATH:/usr/lpp/db2c10_base/lib/clp.jar
  2. Optional: Define the CLPPROPERTIESFILE environment variable in your .profile file to include the full path name where the properties file is located.
    You can create your own properties file with any name. A sample properties file is in the directory where the command line processor is installed. If you install the command line processor into the /usr/lpp/db2c10_base directory, you can issue the following command to define the CLPPROPERTIESFILE environment variable in your .profile file:
    export CLPPROPERTIESFILE=/usr/lpp/db2c10_base/samples/clp.properties
    If the CLPPROPERTIESFILE environment variable is undefined, the command line processor uses default values for all options when it is invoked.
  3. Optional: Define an alias for starting the Db2 command line processor in your .profile file:
    For example:
    alias db2="java com.ibm.db2.clp.db2"

Results

Additional instructions for setting up the Db2 command line processor are available in the readme file. By default, the Db2 command line processor readme file (README_CLP) is installed into the /usr/lpp/db2c10_base directory.