DB2 10.5 for Linux, UNIX, and Windows

Installing the IBM Data Server Driver for JDBC and SQLJ on DB2 for Linux, UNIX, and Windows

After you install the IBM® Data Server Driver for JDBC and SQLJ, you can prepare and run JDBC or SQLJ applications.

Before you begin

Before you install the IBM Data Server Driver for JDBC and SQLJ, you need the following software.

About this task

Restriction: If you install the IBM Data Server Driver for JDBC and SQLJ on a Windows 64-bit operating system, you cannot use IBM Data Server Driver for JDBC and SQLJ type 2 connectivity to connect to a DB2 for Linux, UNIX, and Windows instance from a 32-bit Java application.

Follow these steps to install the IBM Data Server Driver for JDBC and SQLJ.

Procedure

  1. During the DB2 for Linux, UNIX, and Windows installation process, select Java support on UNIX or Linux, or JDBC support on Windows. These selections are defaults. If you have already installed DB2 for Linux, UNIX, and Windows without JDBC support, you can run the installation process in Custom mode to add JDBC support.

    Selection of Java support or JDBC support causes the installation process to perform the following actions:

    1. Installs the IBM Data Server Driver for JDBC and SQLJ class files.

      The files are placed in the sqllib\java directory for Windows systems, or the sqllib/java directory for UNIX or Linux systems.

      The files names are:
      db2jcc.jar or db2jcc4.jar
      Include db2jcc.jar in the CLASSPATH if you plan to use the version of the IBM Data Server Driver for JDBC and SQLJ that includes only JDBC 3.0 or earlier functions.

      Include db2jcc4.jar in the CLASSPATH if you plan to use the version of the IBM Data Server Driver for JDBC and SQLJ that includes JDBC 4.0 or later functions, and JDBC 3.0 or earlier functions.

      sqlj.zip or sqlj4.zip
      Include sqlj.zip in the CLASSPATH if you plan to prepare SQLJ applications that include only JDBC 3.0 or earlier functions.

      Include sqlj4.zip in the CLASSPATH if you plan to prepare SQLJ applications that include JDBC 4.0 or later functions, and JDBC 3.0 or earlier functions.

    2. Modifies the CLASSPATH to include the IBM Data Server Driver for JDBC and SQLJ class files.
      Important: This step is performed automatically only for the db2jcc.jar and sqlj.zip file. If you are using the db2jcc4.jar file or the sqlj4.zip file, you must modify the CLASSPATH manually. Change db2jcc.jar to db2jcc4.jar or sqlj.zip to sqlj4.zip in the CLASSPATH.

      You also need to make this change in every DB2 command line window that you open.

      Important: Include db2jcc.jar or db2jcc4.jar in the CLASSPATH. Do not include both files.
      Important: Include sqlj.zip or sqlj4.zip in the CLASSPATH. Do not include both files. Do not include db2jcc.jar with sqlj4.zip, or db2jcc4.jar with sqlj.zip.
    3. If IBM Data Server Driver for JDBC and SQLJ client license files exist, the installation process installs them and modifies the CLASSPATH to include them.
      The files are placed in the sqllib\java directory for Windows systems, or the sqllib/java directory for UNIX or Linux systems. The file names are:
      Table 2. IBM Data Server Driver for JDBC and SQLJ license files
      License file Server to which license file permits a connection Product that includes license file
      db2jcc_license_cisuz.jar
      • DB2 for z/OS®
      • DB2 for i
      All DB2 Connect™ products

      Client license files are not required for connections to DB2 for Linux, UNIX, and Windows, Cloudscape, or IBM Informix® databases from the IBM Data Server Driver for JDBC and SQLJ version 3.50 or later. Client license files are not required for direct connections to DB2 for z/OS if DB2 Connect Unlimited Edition for System z® server license activation is performed.

      Recommendation: If you connect to DB2 for z/OS data servers directly, rather than through a DB2 Connect gateway, and you use DB2 Connect Unlimited Edition for System z 9.7 Fix Pack 3 or later, you should activate the server license key for DB2 Connect Unlimited Edition for System z. You need to activate the license key on each DB2 for z/OS subsystem or data sharing group to which you will connect. To activate the server license key, you need to run the db2connectactivate utility, which installs the SYSIBM.DB2CON_LIC stored procedure on the DB2 for z/OS data server. See Activating the license key for DB2 Connect Unlimited Edition (System z) for details on server license activation.
    4. Installs IBM Data Server Driver for JDBC and SQLJ native libraries for support of IBM Data Server Driver for JDBC and SQLJ type 2 connectivity.

      The files are placed in the sqllib\bin directory for Windows systems, or the sqllib/lib directory for UNIX or Linux systems.

      The file names are:
      libdb2jcct2.so
      For AIX®, HP-UX on IPF, Linux, and Solaris
      db2jcct2.dll
      For Windows
    As an alternative to installing the IBM Data Server Driver for JDBC and SQLJ class files during installation, you can download the class files, and follow the steps above to configure the driver. You cannot download the IBM Data Server Driver for JDBC and SQLJ type 2 connectivity native libraries. To download the IBM Data Server Driver for JDBC and SQLJ class files, follow these steps:
      • Go to http://www.ibm.com/software/data/support/data-server-clients/download.html.
      • Under Downloads and fixes, select View IBM Data Server Client Packages…
      • In the Refine my fix list window, select Show me more options.
      • On the Fix Central page, select Information Management in the Product Group field, IBM Data Server Client Packages in the Product field, the latest version in the Installed Version field, and All in the Platform field.
      • On the Identify fixes page, type "Data Server Driver for JDBC" in the Text field.
      • On the Select fixes page, select the latest version of the IBM Data Server Driver for JDBC and SQLJ.
      • On the Download options page, select the options that are appropriate for you.
    • Extract the zip file into an empty directory.

      The zip file contains the following files:

      • db2jcc.jar
      • db2jcc4.jar
      • sqlj.zip
      • sqlj4.zip
    • Copy the files to the locations that are specified in step 1.a above.

    After you have downloaded the IBM Data Server Driver for JDBC and SQLJ class files, you need to follow the entire procedure that is described in this topic to install the driver.

  2. Customize the driver-wide configuration properties, if any of the defaults are inappropriate.
  3. Configure TCP/IP.
    Servers must be configured for TCP/IP communication in the following cases:
    • JDBC or SQLJ applications that use IBM Data Server Driver for JDBC and SQLJ type 4 connectivity.
    • JDBC or SQLJ applications that use IBM Data Server Driver for JDBC and SQLJ type 2 connectivity, and specify server and port in the connection URL.

    Ensure that the TCP/IP listener is running. To activate the TCP/IP listener:

    1. Set the environment variable DB2COMM to TCPIP:
         db2set DB2COMM=TCPIP
    2. Update the database manager configuration file with the TCP/IP service name as specified in the services file:
         db2 update dbm cfg using SVCENAME TCP/IP-service-name
      The port number used for applets and SQLJ programs needs to be the same as the TCP/IP SVCENAME number used in the database manager configuration file.
    3. Execute the db2stop and db2start commands for the service name setting to take effect.
  4. On DB2 for Linux, UNIX, and Windows servers on which you plan to run Java stored procedures or user-defined functions, update the database manager configuration to include the path where the SDK for Java is located.

    You can do this by entering commands similar to these on the server command line:

    • For database systems on UNIX or Linux:
      db2 update dbm cfg using JDK_PATH /home/db2inst/jdk15
      /home/db2inst/jdk15 is the path where the SDK for Java is installed.
    • For database systems on Windows:
      db2 update dbm cfg using JDK_PATH c:\Program Files\jdk15
      c:\Program Files\jdk15 is the path where the SDK for Java is installed.
    To verify the correct value for the JDK_PATH field in the DB2 database manager configuration, enter the following command on the database server:
    db2 get dbm cfg
    You might want to redirect the output to a file for easier viewing. The JDK_PATH field appears near the beginning of the output.
  5. If you plan to call SQL procedures that are on DB2 for Linux, UNIX, and Windows servers from Java programs, and the date and time format that is associated with the territory code of the database servers is not the USA format, take the following actions:
    1. Set the DB2_SQLROUTINE_PREPOPTS registry variable on the database servers to indicate that the default datetime format is ISO:
         db2set DB2_SQLROUTINE_PREPOPTS="DATETIME ISO"
    2. Redefine any existing SQL procedures that you plan to call from Java programs.
    These steps are necessary to ensure that the calling application receives date and time values correctly.
  6. If you plan to access DB2 for z/OS database servers with your Java applications, follow the instructions in "Special setup for accessing DB2 for z/OS servers from Java programs."