skip to main content
Troubleshooting Using DataDirect Spy : Generating a DataDirect Spy Log : DataDirect Spy Log Example
 

DataDirect Spy Log Example

The following example shows a DataDirect Spy log for the JDBC Client. The numbers in bold superscript are note indicators that correspond to the notes following the example. They provide explanations for the referenced text to help you understand the content of your own DataDirect Spy logs.
All rights reserved.1
Connection con = DriverManager.getConnection ("jdbc:openaccess://QANT:4003;User=TEST;Password=secret;
SpyAttributes=(log=(file)/tmp/spy.log");2
 
spy>> Driver.connect(String url, Properties info)3
spy>> url = jdbc:spy:{jdbc:openaccess://QANT:4003;Database=Oracle;
OSUser=qauser;OSPassword=null12}
spy>> info = {password=tiger, user=scott}
spy>> OK (Connection[1])4
 
getConnection returning driver[className=com.ddtek.jdbcspy.SpyDriver,
context=null,com.ddtek.jdbcspy.SpyDriver@1ec49f]5
 
spy>> Connection[1].getWarnings()
spy>> OK6
 
spy>> Connection[1].createStatement
spy>> OK (Statement[1])7
 
spy>> Statement[1].executeQuery(String sql)
spy>> sql = select empno,ename,job from emp where empno=7369
spy>> OK (ResultSet[1])8
 
spy>> ResultSet[1].getMetaData()
spy>> OK (ResultSetMetaData[1])9
 
spy>> ResultSetMetaData[1].getColumnCount()
spy>> OK (3)10
 
spy>> ResultSetMetaData[1].getColumnLabel(int column)
spy>> column = 1
spy>> OK (EMPNO)11
 
spy>> ResultSetMetaData[1].getColumnLabel(int column)
spy>> column = 2
spy>> OK (ENAME)12
 
spy>> ResultSetMetaData[1].getColumnLabel(int column)
spy>> column = 3
spy>> OK (JOB)13
 
spy>> ResultSet[1].next()
spy>> OK (true)14
 
spy>> ResultSet[1].getString(int columnIndex)
spy>> columnIndex = 1
spy>> OK (7369)15
 
spy>> ResultSet[1].getString(int columnIndex)
spy>> columnIndex = 2
spy>> OK (SMITH)16
 
spy>> ResultSet[1].getString(int columnIndex)
spy>> columnIndex = 3
spy>> OK (CLERK)17
 
spy>> ResultSet[1].next()
spy>> OK (false)18
 
spy>> ResultSet[1].close()
spy>> OK19
 
spy>> Connection[1].close()
spy>> OK20
NOTES:
1: The Spy driver is registered. The spy>> prefix indicates that this line has been logged by Spy.
2: The JDBC Driver Manager logs a message each time a JDBC driver is registered.
3: This is the logging of the JDBC Driver Manager. It logs a message each time a JDBC application makes a connection.
4: The application connects with the specified URL. The User Name and Password are specified using properties.
5: This is the logging of the JDBC Driver Manager. It logs a message each time a successful connection is made.
6: The application checks to see if there are any warnings. In this example, no warnings are present.
7 and 8: The statement “select empno,ename,job from emp where empno=7369” is created.
9, 10, 11, 12, and 13: Some metadata is requested.
14, 15, 16, and 17: The first row is fetched.
18: The application attempts to fetch the second row, but the database returned only one row for this query.
19: After fetching all data, the result set is closed.
20: The application finishes and disconnects.