Using JDBC data sources
- Last Updated: April 3, 2020
- 2 minute read
- DataDirect Connectors
- JDBC
- Aha! 6.0
- Amazon Redshift 6.0
- Apache Cassandra 6.0
- Apache Hive 6.0
- Apache Spark SQL 6.0
- Atlassian Jira 6.0
- Autonomous REST Connector 6.0
- Cloudera Impala 5.1
- + 24
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
- Java Transaction API (JTA)
You can use DataDirect Spy to track JDBC calls made by a running application
with any of these features. The com.ddtek.jdbcx.Oracle.OracleDataSource class supports setting a semi-colon
separated list of DataDirect Spy attributes. For more information about configuring data
sources, refer to the user’s guide for your driver.
Windows example
The following example creates a JDBC data source for the Oracle driver, which enables DataDirect Spy.
OracleDataSource sds = new OracleDataSource();
sds.setDescription("My Oracle Datasource");
sds.setServerName("Server3");
sds.setPortNumber(1521);
sds.setUser("User123");
sds.setPassword("secret");
sds.setSID("ORCL");
sds.setSpyAttributes("log=(file)C:\\temp\\spy.log;logIS=yes;logTName=yes");
Connection conn=sds.getConnection;
...
log=(file)C:\\temp\\spy.log;logIS=yes;logTName=yes.DataDirect Spy loads the 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
The following example creates a JDBC data source for the Oracle driver, which enables DataDirect Spy.
OracleDataSource mds = new OracleDataSource();
mds.setDescription("My Oracle Datasource");
mds.setServerName("Server3");
mds.setPortNumber(1521);
mds.setUser("User123");
mds.setPassword("secret");
mds.setSID("ORCL");
mds.setSpyAttributes("log=(file)/tmp/spy.log;logIS=yes;logTName=yes");
Connection conn=mds.getConnection;
...
DataDirect Spy loads the 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).