FairCom DB SQL allows Java debugging tools, such as JSwat, to connect and directly debug stored procedure routines. JSwat is an open-source GUI Java debugger, which can be downloaded from https://github.com/nlfiedler/jswat.
FairCom DB SQL allows Java debugging tools to connect and directly debug stored procedure routines. To enable this feature, follow the following steps.
Add the following keywords to ctsrvr.cfg:
SETENV DEBUG_JVM=S
SETENV DEBUG_JVM_PORT=45987
The first keyword enables the FairCom DB SQL JVM debug feature by creating a TCP/IP socket at the port specified with the DEBUG_JVM_PORT keyword for a Java debugger to attach. In addition, the DEBUG_JVM keyword instruct the server to compile stored procedures with debugging information and to not remove the stored procedure source file from disk.
Start the FairCom DB SQL server.
Create a stored procedure (for example, “test”).
Examine the database directory (i.e. ctreeSQL.dbs) for a .java file. This is the Java file source. Pay particular attention to the class name (i.e. public final class admin_test_SP extends JavaBaseSP).
Start a Java debugger and attach it to localhost on the port specified by DEBUG_JVM_PORT.
For example, using the Java debugger included with the JDK, run:
jdb -attach 45987
(run on the same machine running the server to access the Java source files).
Set a breakpoint on the method dhSPwrap of the stored procedure calls (i.e. admin_test_SP.dhSPwrap).
Call the stored procedure from any client side SQL tool such as ISQL.
The debugger should break at the start of the stored procedure.