IBM Support

How to enable DB2 JDBC JCC trace on Tomcat and Weblogic

Technical Blog Post


How to enable DB2 JDBC JCC trace on Tomcat and Weblogic


In case of collecting DB2 JCC trace on client side, we can find the detail from the following link for standalone java and IBM WebSphere.
Collecting Data: Tracing with the IBM Data Server Driver for JDBC and SQLJ

Then, how can we do the same thing on other WAS products.
All WAS(Web application server) products are basically java processes.
Therefore no matter what product you are using, enabling DB2 JCC trace is not other than the following 3 steps from Java perspective.

1. Creating directory for dumping JCC trace files
2. Creating '' file.
3. set the parameter '-Ddb2.jcc.propertiesFile' on Java runtime option.

Here are examples for Tomcat.
( I assume you are already using client application using DB2.
 If you need to know how to set up DB2 client application environment on Tomcat, refer the following link as well.
50 DB2 Nuggets #40: Tech Tip - Configuring pureScale Client Affinity with Tomcat



Step 1. Create directory for dumping JCC trace files.
    For example, I created 'bcc' directory under $TOMCAT_HOME/logs.
   ( NOTE : The path can be any directory where tomcat running user has write permission. )

   $ mkdir jcc

Step 2. Create '' on a directory.
    For example, I created it under $TOMCAT_HOME/conf

$ pwd
$ cat

  ( NOTE : The path 'db2.jcc.traceDirectory' can be any directory. 
                But be sure that you set existing path. Otherwise, all applications will get into problem with error. )

Step 3. set the parameter on java option. ( $TOMCAT_HOME/conf/ )

# Uncomment the following line to make the umask available when using the

### junsulee : DB2 jcc trace : put your full path for
JAVA_OPTS="$JAVA_OPTS -Ddb2.jcc.propertiesFile=/home/tomcat/tomcat8026/conf/"


Then restart tomcat and run a DB2 client application on Tomcat.
Then you can see the JCC trace files on the directory.

$ ls  /home/tomcat/tomcat8026/logs/jcc
trace_global_1    trace_global_2    trace_global_3    trace_global_4


Basically the steps are same with step 1 and 2 on tomcat case above.
For the next, set the java option on the Weblogic start shell script.
Here I copied original lines and added the java option. Then, commented the original line.



echo "starting weblogic with Java version:"

${JAVA_HOME}/bin/java ${JAVA_VM} -version

if [ "${WLS_REDIRECT_LOG}" = "" ] ; then
        echo "Starting WLS with line:"

        #echo "${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME}${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}"

        echo "${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Ddb2.jcc.propertiesFile=/home/weblogic/Oracle/Middleware/wlserver_10.3/samples/domains/wl_server/jcc/ -Dweblogic.Name=${SERVER_NAME}${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}"

        #${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME}${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}

        ${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Ddb2.jcc.propertiesFile=/home/weblogic/Oracle/Middleware/wlserver_10.3/samples/domains/wl_server/jcc/ -Dweblogic.Name=${SERVER_NAME}${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}

        echo "Redirecting output from WLS window to ${WLS_REDIRECT_LOG}"
        #${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME}${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}  >"${WLS_REDIRECT_LOG}" 2>&1

        ${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Ddb2.jcc.propertiesFile=/home/weblogic/Oracle/Middleware/wlserver_10.3/samples/domains/wl_server/jcc/ -Dweblogic.Name=${SERVER_NAME}${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}  >"${WLS_REDIRECT_LOG}" 2>&1




[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]