ASA SQL User's Guide
Debugging Logic in the Database
Tutorial: Getting started with the debugger
Lesson 3: Debug a Java class
In this lesson you inspect the values of both local variables (declared in a method) and class static variables in the debugger.
You can inspect the values of local variables in a method as you step through the code, to better understand what is happening. You must have compiled the class with the javac -g
option to do this.
To inspect and modify the value of a variable
Set a breakpoint at the first line of the JDBCExamples.Query method. This line is as follows:
int max_price = 0
In Interactive SQL, enter the following statement again to execute the method:
SELECT JDBCExamples.Query()
The query executes only as far as the breakpoint.
Press F10 to step to the next line. The max_price variable has now been declared and initialized to zero.
In the Local tab list, double-click the Value column entry for max_price, and type in 45 to change the value of max_price to 45.
The value 45 is larger than any other price. Instead of returning 24, the query will now return 45 as the maximum price.
Press F10 repeatedly to step through the code. As you do so, the values of the variables appear in the Local tab list. Step through until the stmt and result variables have values.
Expand the result object by clicking the icon next to it, or setting the cursor on the line and pressing Enter. This displays the values of the fields in the object.
When you have experimented with inspecting and modifying variables, press F5 to complete the execution of the query and finish the tutorial.
In addition to local variables, you can display class-level variables (static variables) in the debugger Statics tab, and watch their values in the Watch tab. For more information, see the debugger online Help.