Troubleshooting InterClient Programs

Handling Installation Problems

You can call interbase.interclient.utils.CommDiag to test an InterClient installation. CommDiag provides two static methods for testing the installation. A static main is provided as a command line test that prints to System.out. main() uses the other public static methods that test specific features of the installation. These methods can be used by a GUI application as they return strings, rather than writing the diagnostics to System.out as main() does. CommDiag allows you to:

Debugging Your Application

You can tailor your own driver instances by using a class called interbase.interclient.Monitor. This is a public InterClient extension to JDBC. The Monitor class contains user-configurable switches that enable you to call a method and trace what happens on a per-driver basis. Types of switches that you can enable include: enableDriverTrace, enableConnectionTrace, enableStatementTrace, etc.)

Every driver instance has one and only one monitor instance associated with it. The initial monitor for the default driver instance that is implicitly registered with the DriverManager has no logging/tracing enabled. Enabling tracing for the default driver is not recommended. However, if you create your own driver instance, you can tailor the tracing and logging for your driver without affecting the default driver registered with the DriverManager.

The following example shows calls to getMonitor() trace methods:

//Open the driver manager's log stream
DriverManager.setLogStream(System.out);

//Create the driver object
java.sql.Driver icDriver = new interbase.interclient.Driver();

//Trace method invocations by printing messages to this monitor's
//trace stream
((interbase.interclient.Driver)icDriver).getMonitor().setTraceStream
    (System.out);
((interbase.interclient.Driver(icDriver).getMonitor().enableAllTraces (true);
After running the program and executing some SQL statements, you can print out the trace messages associated with the driver, connection, and statement methods. The tracing output distinguishes between implicit calls, such as the garbage collector or InterClient driver calling close() vs. user-explicit calls. This can be used to test application code, since it would show if result sets or statements aren't being cleaned up when they should.