skip to main content
Tracking JDBC Calls : Using DataDirect Spy with JDBC Data Sources
 

Using DataDirect Spy with JDBC Data Sources

The JDBC driver implements the following features defined by the JDBC 2.0 Optional Package:
JNDI for Naming Databases
Connection Pooling
You can use Spy to track JDBC calls with all of these features. The com.ddtek.jdbcx.openaccess.OpenAccessDataSource class supports the SpyAttributes connection attribute, which specifies a semi-colon-separated list of Spy attributes as described in DataDirect Spy Attributes. See JDBC Connection URL Examples for more information about configuring JDBC data sources.
The following examples create an OpenAccessDataSource and specifies that all JDBC calls must be logged in the file /tmp/spy.log, including the name of the current thread:
...
OpenAccessDataSource sds=new OpenAccessDataSource():
sds.setServerName("MyServer");
sds.setPortNumber(1234);
sds.setSpyAttributes("log=(file)/tmp/spy.log;logTName=yes");
Connection conn=sds.getConnection("scott","tiger");
...