SQL-Retriever ODBC

Debug

JDBC Debug

Debug is enabled in the same way as it is for ODBC debug from a non-dialog based perspective. The value of DebugOptions is set to the required level. In JDBC this should be done in the connection URL.

Debug logs are very difficult for JDBC due to the secure nature of the Java Virtual Machine. The only way to switch on debug is to add it to the URL inside the applet. It is therefore necessary to go back to the applet source (and possibly the developer) to add the necessary DebugOptions to the URL to enable debug.

NOTE: If the JDBC application is an applet rather than a true application, debug logs will not be written. The first reason for this is that from a client perspective they can't be because applets cannot write to the client disk (they are not trusted). The second reason is that if they were to write to UNIX, the server's disk might inadvertently become full.

There are three ways to get debug logs, with varying degrees of success:

  1. Temporarily rewrite the parts of the applet causing the problem into an application. Applications are client based and are trusted, and thus can write the logs. This can be time-consuming and is not advised.
  2. Copy the applet to the PC and create an HTML document on the PC to load it. The applet should then be trusted. Currently, most Web Browsers still don't trust these applets, so a log may not be generated.
  3. The preferred method is to ask the customer to load the applet into appletviewer (via an HTML document), then add debug to the URL. Appletviewer will run the applet in a trusted kind of way; thus debug logs can be written.

The way to enable debug on the JDBC driver is:

String url = "jdbc:sqlr:myUnix:Ingres;DBname=myDatabase;DBuser=;DBauth=;Application=myApplication;DebugPCFile=myDebug.txt;DebugPCAppend=0;DebugHostFile=myDebug.log;DebugHostAppend=0;DebugOptions=895";

(There are different forms of the above getConnection API call; this is just one of them.) The recommended level for DebugOptions is 895 for SQL-Retriever 4.

To enable debug, the key DebugOptions must be added to the URL. Therefore, only the JDBC Applet developer would typically turn this on.

Unless the names are changed, the Debug logs are written to \VWODBC.TXT on the client and vwodbc.log on the host in the directory of the UNIX user being used to connect.

The following are optional keys (these are the same as the ODBC driver):
DebugPCFile // Applications only
DebugPCAppend (1/0) // Applications only
DebugHostFile // Applications only
DebugHostAppend(1/0) // Applications only
DebugOptions (mask) // Applications only

Note: DBoptions is not related to DebugOptions.

With new versions of some browsers (e.g. IE4), it is possible to configure the browser to over-ride the trusted status of writing to the client disk and therefore facilitate writing JDBC debug logs.

For debug logs for ODBC, see SQL-Retriever debug log files.