Chapter 2. DB2 UDB architecture overview 67
2.6.1 CLI/ODBC/JDBC trace
The DB2 CLI and JDBC drivers offer extensive tracing facilities. Tracing
generates one or more log files when an application accesses a DB2 CLI or DB2
JDBC driver. The log files provide the following information:
򐂰 Order in which CLI or JDBC functions are called by application
򐂰 Contents of input and output parameters passed to and received from CLI or
JDBC functions
򐂰 Return code and error or warning messages generated by DB2 CLI or DB2
JDBC functions
DB2 CLI and DB2 JDBC trace facilities help application developers debug
programs, and also assist the DBA in tuning the application, as follows:
򐂰 A DB2 CLI trace may show a table being queried many times on a particular
set of attributes, suggesting that an index corresponding to those attributes
may improve application performance.
򐂰 Understand third party application software calls to the database, even
though there is no flexibility to modify the SQL itself.
A DB2 CLI trace reads configuration parameters from the DB2 CLI configuration
file db2cli.ini located in the sqllib directory. The contents of db2cli.ini may be
viewed by issuing the following command:
db2 get cli cfg for section common
The following command updates the db2cli.ini file and enables the DB2 CLI trace
facility:
DB2 update cli cfg for section common using trace 1
For more details, refer to DB2 UDB Call Level Interface Guide and Reference,
Volume 1, SC09-4849 and DB2 UDB Call Level Interface Guide and Reference,
Volume 2, SC09-4850.
The DB2 UDB Version 8 JDBC trace is invoked by embedding the code shown in
Example 2-2 on page 67. The trace is written to driverLog.txt.
Example 2-2 Enabling JDBC trace in DB2 UDB Version 8
java.io.PrintWriter printWriter = null;
try {
printWriter =
new java.io.PrintWriter(
new java.io.BufferedOutputStream(

Get DB2 UDB ESE V8 non-DPF Performance Guide for High Performance OLTP and BI now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.