You can use DataDirect Spy to track JDBC calls made by a running application with either of these features:

  • JNDI for Naming Databases
  • Connection Pooling

The com.ddtek.jdbcx.SForce.SForceDataSource class supports setting a semi-colon separated list of DataDirect Spy attributes.

Windows Example

SForceDataSource sds = new SForceDataSource();
sds.setDescription("My Salesforce Datasource");
sds.setServerName("login.salesforce.com");
sds.setUser("abc@defcorp.com");
sds.setPassword("secret");
sds.setSecurityToken("XaBARTsLZReM4Px47qPLOS");
sds.setSpyAttributes("log=(file)C:\\temp\\spy.log;logIS=yes;logTName=yes");
Connection conn=sds.getConnection;
...
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 Salesforce driver and logs 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).

UNIX Example

SForceDataSource mds = new SForceDataSource();
mds.setDescription("My Salesforce Datasource");
mds.setServerName("login.salesforce.com");
mds.setUser("abc@defcorp.com");
mds.setPassword("secret");
mds.setSecurityToken("XaBARTsLZReM4Px47qPLOS");
mds.setSpyAttributes("log=(file)/tmp/spy.log;logIS=yes;logTName=yes");
Connection conn=mds.getConnection;
...

DataDirect Spy loads the Salesforce driver and logs all JDBC activity to the spy.log file located in the /tmp directory (log=(file)/tmp/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).