IBM DB2 Manual page 500

Table of Contents

Advertisement

2. Invoke the DriverManager.setLogWriter method to specify the trace destination
After a connection is established, you can turn the trace off or back on, change the
trace destination, or change the trace level with the
DB2Connection.setJccLogWriter method. To turn the trace off, set the logWriter
value to null.
The logWriter property is an object of type java.io.PrintWriter. If your
application cannot handle java.io.PrintWriter objects, you can use the traceFile
property to specify the destination of the trace output. To use the traceFile
property, set the logWriter property to null, and set the traceFile property to the
name of the file to which the driver writes the trace data. This file and the
directory in which it resides must be writable. If the file already exists, the driver
overwrites it.
Procedure 5: If you are using the DriverManager interface, specify the traceFile and
traceLevel properties as part of the URL when you load the driver. For example:
String url = "jdbc:db2://sysmvs1.stl.ibm.com:5021/san_jose" +
Procedure 6: Use DB2TraceManager methods. The DB2TraceManager class provides the
ability to suspend and resume tracing of any type of log writer.
Example of starting a trace using configuration properties: For a complete example of
using configuration parameters to collect trace data, see "Example of using
configuration properties to start a JDBC trace".
Trace example program: For a complete example of a program for tracing under the
IBM Data Server Driver for JDBC and SQLJ, see "Example of a trace program
under the IBM Data Server Driver for JDBC and SQLJ".
Collecting SQLJ trace data during customization or bind
To collect trace data to diagnose problems during the SQLJ customization or bind
process, specify the -tracelevel and -tracefile options when you run the
db2sqljcustomize or db2sqljbind bind utility.
Formatting information about an SQLJ serialized profile
The profp utility formats information about each SQLJ clause in a serialized
profile. The format of the profp utility is:
profp serialized-profile-name
Run the profp utility on the serialized profile for the connection in which the error
occurs. If an exception is thrown, a Java stack trace is generated. You can
determine which serialized profile was in use when the exception was thrown
from the stack trace.
484
Application Programming Guide and Reference for Java
The default trace level is TRACE_ALL. See "Properties for the IBM Data Server
Driver for JDBC and SQLJ" for information on how to specify more than one
type of tracing.
and turn the trace on.
":traceFile=/u/db2p/jcctrace;" +
"traceLevel=" + com.ibm.db2.jcc.DB2BaseDataSource.TRACE_DRDA_FLOWS + ";";

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents