JDBC trace configuration
If your application displays JDBC-related exception messages, activate the JDBC trace service. The resulting log text can help you identify the problem.
Turn on tracing for most database JDBC implementations through the administrative console; see the topic, Enabling trace at server startup for instructions.
- Trace string for JDBC drivers of DB2® databases.See the following DB2 database sample:
- Note: To use the Oracle trace string and sample, you must complete the actions in the next section, Provider-specific configuration.Trace string for JDBC drivers of Oracle databases.See the following Oracle database sample:
- Trace string for JDBC drivers of Derby databases.
- Trace string for JDBC drivers of Informix® databases.
- Trace string for JDBC drivers of Microsoft SQL Server databases.
- Trace string for JDBC drivers of Sybase databases.
- Trace string for other JDBC drivers.
- Microsoft SQL Server JDBC driver
- DataDirect Connect for JDBC driver for MS SQL Server
Set trace for the previously mentioned JDBC drivers through data source custom properties. For example, use the spyAttributes custom property to enable JDBC trace for the DataDirect Connect for JDBC driver. Consult your driver documentation for details on the custom property that enables trace for your JDBC implementation.
- DB2 data sourcesThe custom properties for a data source with DB2 Data Server Driver for JDBC and SQLJ are:
Avoid trouble: If you change the values for traceLevel, traceFile, or traceFileAppend, then the you must restart the application server to instantiate new data source objects with the changed settings.
The possible values for traceLevel are:
Avoid trouble: Trace of Statement calls will expose the user data in sets to the PreparedStatement objects, and Trace of ResultSet calls will expose data returned in gets from the ResultSet objects.
- TRACE_NONE = 0
- TRACE_CONNECTION_CALLS = 1
- TRACE_STATEMENT_CALLS = 2
- TRACE_RESULT_SET_CALLS = 4
- TRACE_DRIVER_CONFIGURATION = 16
- TRACE_CONNECTS = 32
- TRACE_DRDA_FLOWS = 64
- TRACE_RESULT_SET_META_DATA = 128
- TRACE_PARAMETER_META_DATA = 256
- TRACE_DIAGNOSTICS = 512
- TRACE_SQLJ = 1024
- TRACE_XA_CALLS = 2048
- TRACE_META_CALLS = 8192
- TRACE_DATASOURCE_CALLS = 16384
- TRACE_LARGE_OBJECT_CALLS = 32768
- TRACE_SYSTEM_MONITOR = 131072
- TRACE_TRACEPOINTS = 262144
- TRACE_ALL = -1
- Specifies to integrate the DB2 Data Server Driver for JDBC and SQLJ trace with the application server's trace function:
- If you do not set the value, traces are integrated.If you use integrated trace, you can dynamically enable or disable trace by setting the following property in the application server's trace specification at run time:
- If you set the traceFile property to a valid path name for a file, then the Data Server Driver trace is written to the specified file regardless of the application server's trace specification.
- If you do not set the value, traces are integrated.
- Specifies to append to or overwrite the file that is specified by the traceFile property:
- To append to the current file, set the property to true.
- To overwrite the current file, set the property to false.
- Microsoft SQL Server for JDBC driver
For more information about enabling logging in the Microsoft SQL Server JDBC Driver, see the documentation from Microsoft.
However, instead of specifying the logger programmatically or by modifying the logging.properties file (as would be done for standalone Java™ apps), set the logging information within the application server trace string. For example, the following trace specification combines both the application server JDBC trace with Microsoft SQL Server JDBC Driver logging:
- Oracle JDBC driver tracing configuration
- Ensure you are using the debug version of the Oracle JDBC driver, which is the version ending
_g. For example, if you were using the ojdbc8.jar file, replace it with the ojdbc8_g.jar file. If you are using multiple providers, ensure that all Oracle JDBC providers use the option Isolate classloader.
- Enable the
oracle.*=alltrace string, which enables all Oracle JDBC driver trace at the most detailed level.
- Activate the debug library by setting the following JVM argument on the application server:
For more information about configuring the Oracle JDBC driver tracing configuration, see the IBM® Support documentation.
- Ensure you are using the debug version of the Oracle JDBC driver, which is the version ending with
If the JDBC tracing service cannot help you isolate and fix your problem, consult the IBM Support website for WebSphere® Application Server. Use the site search function to find current information on known problems and their resolutions. Locating the proper troubleshooting tip can save time that you might otherwise spend on opening and tracking a PMR.