skip to main content
About the Driver : Using the driver : Tracking JDBC calls with DataDirect Spy : Enabling DataDirect Spy : Using JDBC data sources
  

Try DataDirect Drivers Now
Using JDBC data sources
The drivers implement the following JDBC features:
*JNDI for Naming Databases
*Connection Pooling
You can use DataDirect Spy to track JDBC calls made by a running application with either of these features. The com.ddtek.jdbcx.datasource.DriverDataSource class, where Driver is the driver name, supports setting a semi-colon-separated list of DataDirect Spy attributes (see "DataDirect Spy attributes").
Note: The following examples are drawn from DB2 and Oracle use cases. However, they inform the implementation of DataDirect Spy for most Progress DataDirect drivers.

Example on Windows:

The following example creates a JDBC data source for the DB2 driver, which enables DataDirect Spy.
DB2DataSource sds=new DB2DataSource():
sds.setServerName("Server1");
sds.setPortNumber(50000);
sds.setSpyAttributes("log=(file)C:\\temp\\spy.log;logIS=yes;logTName=yes");
Connection conn=sds.getConnection("TEST","secret");
...
Note: If coding a path on Windows to the log file in a Java string, the backslash character (\) must be preceded by the Java escape character, a backslash. For example: log=(file)C:\\temp\\spy.log;logIS=yes;logTName=yes.
DataDirect Spy loads the DB2 driver and log all JDBC activity to the spy.log file located in the C:\temp directory (log=(file)C:\\temp\\spy.log). In addition to regular JDBC activity, the spy.log file also logs activity on InputStream and Reader objects (logIS=yes). It also includes the name of the current thread (logTName=yes).

Example on UNIX:

The following example creates a JDBC data source for the Oracle driver, which enables DataDirect Spy.
OracleDataSource mds = new OracleDataSource();
mds.setServerName("Server1");
mds.setPortNumber(1521);
mds.setSID("ORCL");...
mds.setSpyAttributes("log=(file)/tmp/spy.log;logTName=yes");
Connection conn=mds.getConnection("TEST","secret");
...
DataDirect Spy loads the Oracle driver and logs all JDBC activity to the spy.log file located in the /tmp directory (log=(file)/tmp/spy.log). The spy.log file includes the name of the current thread (logTName=yes).