Enabling the connector to work with a DB2 database

Before you can use the connector with a DB2 database, you must perform the following steps (for Linux, go to the next set of instructions):

Note:
For i5/OS, no action is required to enable the connector to work with a DB2 database.

  1. Copy the file named db2java.zip from the DB2 host to the ProductDir\lib directory on the machine on which the connector is going to run.
  2. Copy the file named db2jdbc.dll from the DB2 host to the ProductDir\bin directory on the machine on which the connector is going to run.
  3. Depending on your operating system, change the following in the connector's YP file (start_JDBC.sh or start_JDBC.bat):

    Windows: set JDBCDRIVERPATH=ProductDir\lib\db2java.zip

  4. On the DB2 host machine, start the DB2/bin/db2jstrt process. Be sure to specify the number of the port you are using (for example, DB2/bin/db2jstrt 50000).
  5. Set the value of the connector's JDBCDriverClass property to COM.ibm.db2.jdbc.net.DB2Driver (or COM.ibm.db2.jdbc.app.DB2Driver if the DB2 database is on the same machine on which the connector is going to run).
  6. Set the value of the connector's DatabaseURL property to jdbc:db2://MachineName:PortNumber/DBname (or jdbc:db2:DBname if the DB2 database is on the same machine on which the connector is going to run).

For Linux before you can use the connector with a DB2 database, you must perform the follow steps:

  1. Copy the file named db2java.zip from the DB2 directory, for example,
    /opt/IBM/db2/v8.1/java
    to the $Productdir/lib directory on the machine on which the connector is going to run.
  2. Copy the file named libdb2dbc.so from the DB2 directory, for example,
    /opt/IBM/db2/v8.1/lib
    to the $ProductDir/bin directory on the machine on which the connector is going to run.
  3. Change the following in the connector's startup file start_JDBC.sh:
    JDBCDRIVERPATH="${CROSSWORLDS}/lib/db2java.zip".
  4. Create a catalog on the machine on which the connector is going to run for the DB2 database that the connector will access, even if it is located on the local machine. Assume that this database is named SMBDB, and the hostname of the machine on which it is located is named remhost. On the local machine, enter the following commands at the DB2 command line:
    db2=> CATALOG TCPIP MODE remnode REMOTE remhost SERVER 50000
    This command will create a TCP/IP node on the local machine named remnode for remote host remhost and remhost can be the hostname of the local machine if the database is local.
    db2=> CATALOG DATBASE SMBDB AS SMBDBALI AT MODE remnode
    This command will create an alias named SMBDBALI for the database SMBDB, which is located on node remnode. Set the value of the connector's DatabaseURL property to jdbc:db2:SMDBDALI. Set the value of the connector's JDBCDriverClass property to COM.ibm.db2.jdbc.app.DB2Driver.
Note:
It is important to perform step 4 when the DB2 database is on the Linux platform. If one accesses the database directly instead of through its alias, a JDBC error could occur because of an unknown problem with the DB2 CLI driver on the Linux platform. this step must be performed for JDBCODA to access the DB2 database on the Linux platform.

If you specify the value of the connector's DBCDriverClass property to COM.ibm.db2.jdbc.net.DB@Driver, then first do the following steps:

  1. Copy the file named db2java.zip and db2jcc.jar from the DB2 directory, for example,
    /opt/IBM/db2/v8.1/java, to the $Product/Dir/lib directory on the machine on which the connector is going to run.
  2. Copy the file named libdb2jdbc.so from the DB2 directory, for example,
    /opt/IBM/db2/v8.1/lib, to the $ProductDir/bin directory on the computer which the connector is going to run.
  3. Change the following in the connector's startup file start_JDBC.sh:
    JDBCDRIVERPATH=
    "${CROSSWORLDS}/lib/db2java.zip:${CROSSWORLDS}/lib/db2jcc.jar".
  4. Set the value of the connector's DatabaseURL property to
    jdbc:db2://MachineName:PortNumber/DBname.
  5. On the DB2 host machine, start the /opt/IBM/db2/v8.1/bin/db2jstrt process. Be sure to specify the number of the port you are using.

Copyright IBM Corp. 2004, 2005