To help you troubleshoot any problems that occur with your application, you can use DataDirect Spy to log detailed information about calls issued by the drivers on behalf of your application. When you enable DataDirect Spy for a connection, you can customize DataDirect Spy logging by setting one or multiple options. See Chapter 8 “Tracking JDBC Calls with DataDirect Spy™” for information about using DataDirect Spy and instructions on enabling and customizing logging.Turning On and Off DataDirect Spy™ LoggingOnce DataDirect Spy logging is enabled for a connection, you can turn on and off the logging at runtime using the setEnableLogging() method in the com.ddtek.jdbc.extensions.ExtLogControl interface. When DataDirect Spy logging is enabled, all Connection objects returned to an application provide an implementation of the ExtLogControl interface.Connection con = DriverManager.getConnection
("jdbc:datadirect:sqlserver://server1:1433;User=TEST;Password=secret;
SpyAttributes=(log=(file)/tmp/spy.log");The setEnableLogging() method only turns on and off logging if DataDirect Spy logging has already been enabled for a connection; it does not set or change DataDirect Spy attributes. See “Enabling DataDirect Spy™” for information about enabling and customizing DataDirect Spy logging.DataDirect Spy™ Log ExampleThis section provides information to help you understand the content of your own DataDirect Spy logs. For example, suppose your application executes the following code and performs some operations:DriverManager.getConnection("jdbc:datadirect:sqlserver:// nc-myserver\
\sqlserver2005;useServerSideUpdatableCursors=true;resultsetMetaDataOptions=1;sendStringParametersAsUnicode=true;alwaysReportTriggerResults=false;
spyAttributes=(log=(file)c:\\temp\\spy.log)","test04", "test04");The log file generated by DataDirect Spy would look similar to the following example. Notes provide explanations for the referenced text.spy>> OK (jdbc:datadirect:sqlserver://nc-myserver\sqlserver2005:1433;CONNECTIONRETRYCOUNT=5;RECEIVESTRINGPARAMETERTYPE=nvarchar;ALTERNATESERVERS=;DATABASENAME=;PACKETSIZE=16;INITIALIZATIONSTRING=;ENABLECANCELTIMEOUT=false;BATCHPERFORMANCEWORKAROUND=false;AUTHENTICATIONMETHOD=auto;SENDSTRINGPARAMETERSASUNICODE=true;LOGINTIMEOUT=0;WSID=;SPYATTRIBUTES=(log=(file)c:\temp\spy.log);RESULTSETMETADATAOPTIONS=1;ALWAYSREPORTTRIGGERRESULTS=false;TRANSACTIONMODE=implicit;USESERVERSIDEUPDATABLECURSORS=true;SNAPSHOTSERIALIZABLE=false;JAVADOUBLETOSTRING=false;SELECTMETHOD=direct;LOADLIBRARYPATH=;CONNECTIONRETRYDELAY=1;INSENSITIVERESULTSETBUFFERSIZE=2048;MAXPOOLEDSTATEMENTS=0;DESCRIBEPARAMETERS=noDescribe;CODEPAGEOVERRIDE=;NETADDRESS=000000000000;PROGRAMNAME=;LOADBALANCING=false;HOSTPROCESS=0) 1
The statement select empno,ename,job from emp where empno=7369 is created.