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):
- 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.
- 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.
- Depending on your operating system, change the following in the
connector's startup file (start_JDBC.sh or start_JDBC.bat):
set
JDBCDRIVERPATH=%ProductDir%\lib\db2java.zip
- 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).
- 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).
- 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 following steps:
- 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.
- 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 machine on which
the connector is going to run.
- Change the following in the connector's startup file
start_JDBC.sh:
JDBCDRIVERPATH="${CROSSWORLDS}/lib/db2java.zip"
- Create a catalog on the machine on which the connector is going
to run for the DB2 database that the connecor 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 NODE 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 DATABASE SMBDB AS SMBDBALI AT NODE 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:SMBDBALI. 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 also be performed for JDBCODA to access the DB2 database
on the Linux platform.
If you specify the value of the connector's JDBCDriverClass
property to COM.ibm.db2.jdbc.net.DB2Driver, then first do
the following steps:
- Copy the file named db2java.zipand 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.
- 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 machine on which the connector is
going to run.
- Change the following in the connector's startup file
start_JDBC.sh:
JDBCDRIVERPATH="${CROSSWORLDS}/lib/db2java.zip:${CROSSWORLDS}/
lib/db2jcc.jar"
- Set the value of the connector's DatabaseURL property to
jdbc:db2://MachineName:PortNumber/DBname.
- 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.
