JDBC Type 2 Driver Programmer's Reference for SQL/MX Release 3.1 (H06.23+, J06.12+)

Home | Contents | Index | Glossary | Prev | Next
JDBC Trace Facility
The JDBC trace facility traces the entry point of all JDBC methods called from the Java applications. To make this
facility generic, it is implemented as a JDBC driver wrapper.
The JDBC trace facility can be enabled in any of the following ways in which a JDBC connection to a database can
be obtained:
Tracing using the DriverManager Class
Tracing using the DataSource Implementation
Tracing using the java command
Tracing using the system.setProperty method
Tracing by loading the trace driver within the program
Tracing using a wrapper data source
Enabling Tracing for Application Servers
Trace-File Output Format
Logging SQL Statement IDs and Corresponding JDBC SQL Statements
JDBC Trace Facility Demonstration Program
Tracing Using the DriverManager Class
Java applications can use the DriverManager class to obtain the JDBC connection and enable the JDBC trace facility
by loading the JDBC trace driver. com.tandem.jdbc.TDriver is the trace driver class that implements the Driver
interface. The application can load the JDBC trace driver in one of the following ways:
Specify the JDBC trace driver class in the -Djdbc.drivers option in the command line.
Use the Class.ForName method within the application.
Add the JDBC trace class to the jdbc.drivers property within the application.
The JDBC URL passed in the getConnection method of the driver class determines which JDBC driver obtains the
connection. Use the following URL and JDBC driver to obtain the JDBC connection:
jdbc:sqlmx:
Java applications should turn on tracing using the DriverManager.setLogWriter method, for example by using the
following JDBC API call in your application:
DriverManager.setLogWriter(new PrintWriter(new FileWriter("FileName")));
Tracing Using the DataSource Implementation
This is preferred way to establish a JDBC connection and to enable the JDBC trace facility. In this way, a logical