DB2 10.5 for Linux, UNIX, and Windows

DB2TraceManagerMXBean interface

The com.ibm.db2.jcc.mx.DB2TraceManagerMXBean interface is the means by which an application makes DB2TraceManager available as an MXBean for the remote trace controller.

DB2TraceManagerMXBean methods

setTraceFile
Format:
public void setTraceFile(String traceFile, 
  boolean fileAppend, int traceLevel) 
  throws java.sql.SQLException

Specifies the name of the file into which the remote trace manager writes trace information, and the type of information that is to be traced.

Parameter descriptions:
traceFileName
Specifies the file into which global trace information is written. This setting overrides the settings of the traceFile and logWriter properties for a DataSource or DriverManager connection.

When the form of setLogWriter with the traceFileName parameter is used, only one log file is written.

traceFileName can include a directory path.

fileAppend
Specifies whether to append to or overwrite the file that is specified by the traceFile parameter. true means that the existing file is not overwritten.
traceLevel
Specifies what to trace.
You can specify one or more of the following traces with the traceLevel parameter:
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_NONE (X'00')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_CONNECTION_CALLS (X'01')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_STATEMENT_CALLS (X'02')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_RESULT_SET_CALLS (X'04')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_DRIVER_CONFIGURATION (X'10')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_CONNECTS (X'20')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_DRDA_FLOWS (X'40')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_RESULT_SET_META_DATA (X'80')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_PARAMETER_META_DATA (X'100')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_DIAGNOSTICS (X'200')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_SQLJ (X'400')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_XA_CALLS (IBM® Data Server Driver for JDBC and SQLJ type 2 connectivity for DB2® for Linux, UNIX, and Windows only) (X'800')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_META_CALLS (X'2000')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_DATASOURCE_CALLS (X'4000')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_LARGE_OBJECT_CALLS (X'8000')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_SYSTEM_MONITOR (X'20000')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_TRACEPOINTS (X'40000')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_SYSPLEX (X'80000')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_ALL (X'FFFFFFFF')
To specify more than one trace, use one of these techniques:
  • Use bitwise OR (|) operators with two or more trace values. For example, to trace DRDA® flows and connection calls, specify this value for traceLevel:
    TRACE_DRDA_FLOWS|TRACE_CONNECTION_CALLS
  • Use a bitwise complement (tilde (~)) operator with a trace value to specify all except a certain trace. For example, to trace everything except DRDA flows, specify this value for traceLevel:
     ~TRACE_DRDA_FLOWS
getTraceFile
Format:
public void getTraceFile() 
  throws java.sql.SQLException

Returns the name of the destination file for the remote trace controller, if it is set. Otherwise, getTraceFile returns null.

setTraceDirectory
Format:
public void setTraceDirectory(String traceDirectory, 
  String baseTraceFileName, 
  int traceLevel) throws java.sql.SQLException

Specifies the name of the directory into which the remote trace controller writes trace information, and the type of information that is to be traced.

Parameter descriptions:
traceDirectory
Specifies a directory into which trace information is written. This setting overrides the settings of the traceDirectory and logWriter properties for a DataSource or DriverManager connection.
Each JDBC driver connection is traced to a different file in the specified directory. The naming convention for the files in that directory depends on whether a non-null value is specified for baseTraceFileName:
  • If a null value is specified for baseTraceFileName, a connection is traced to a file named traceFile_global_n.

    n is the nth JDBC driver connection.

  • If a non-null value is specified for baseTraceFileName, a connection is traced to a file named baseTraceFileName_global_n.

    baseTraceFileName is the value of the baseTraceFileName parameter.

    n is the nth JDBC driver connection.

baseTraceFileName
Specifies the stem for the names of the files into which global trace information is written. The combination of baseTraceFileName and traceDirectory determines the full path name for the global trace log files.
traceLevel
Specifies what to trace.
You can specify one or more of the following traces with the traceLevel parameter:
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_NONE (X'00')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_CONNECTION_CALLS (X'01')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_STATEMENT_CALLS (X'02')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_RESULT_SET_CALLS (X'04')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_DRIVER_CONFIGURATION (X'10')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_CONNECTS (X'20')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_DRDA_FLOWS (X'40')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_RESULT_SET_META_DATA (X'80')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_PARAMETER_META_DATA (X'100')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_DIAGNOSTICS (X'200')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_SQLJ (X'400')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_XA_CALLS (IBM Data Server Driver for JDBC and SQLJ type 2 connectivity for DB2 for Linux, UNIX, and Windows only) (X'800')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_META_CALLS (X'2000')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_DATASOURCE_CALLS (X'4000')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_LARGE_OBJECT_CALLS (X'8000')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_SYSTEM_MONITOR (X'20000')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_TRACEPOINTS (X'40000')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_SYSPLEX (X'80000')
  • com.ibm.db2.jcc.DB2BaseDataSource.TRACE_ALL (X'FFFFFFFF')
To specify more than one trace, use one of these techniques:
  • Use bitwise OR (|) operators with two or more trace values. For example, to trace DRDA flows and connection calls, specify this value for traceLevel:
    TRACE_DRDA_FLOWS|TRACE_CONNECTION_CALLS
  • Use a bitwise complement (tilde (~)) operator with a trace value to specify all except a certain trace. For example, to trace everything except DRDA flows, specify this value for traceLevel:
     ~TRACE_DRDA_FLOWS
getTraceFileAppend
Format:
public abstract boolean getTraceFileAppend()
  throws java.sql.SQLException

Returns true if trace records that are generated by the trace controller are appended to the trace file. Otherwise, getTraceFileAppend returns false.

getTraceDirectory
Format:
public void getTraceDirectory() 
  throws java.sql.SQLException

Returns the name of the destination directory for trace records that are generated by the trace controller, if it is set. Otherwise, getTraceDirectory returns null.

getTraceLevel
Format:
public void getTraceLevel() 
  throws java.sql.SQLException

Returns the trace level for the trace records that are generated by the trace controller, if it is set. Otherwise, getTraceLevel returns -1 (TRACE_ALL).

unsetLogWriter
Format:
public abstract void unsetLogWriter()
  throws java.sql.SQLException

Disables the global log writer override for future connections.

suspendTrace
Format:
public void suspendTrace()
  throws java.sql.SQLException

Suspends all global, Connection-level, or DataSource-level traces for current and future connections. suspendTrace can be called when the global log writer is enabled or disabled.

resumeTrace
Format:
public void resumeTrace()
  throws java.sql.SQLException

Resumes all global, Connection-level, or DataSource-level traces for current and future connections. resumeTrace can be called when the global log writer is enabled or disabled. If the global log writer is disabled, resumeTrace resumes Connection-level or DataSource-level traces. If the global log writer is enabled, resumeTrace resumes the global trace.