Contents Index Confirm the diagnosis and fix the bug Prepare the database

ASA SQL User's Guide
  Debugging Logic in the Database
    Tutorial: Getting started with the debugger

Lesson 3: Debug a Java class


This lesson describes a sample session for debugging a Java class.

This lesson requires that you have the Java in the database component. Java in the database is a separately licensable component and must be ordered before you can install it. To order this component, see the card in your SQL Anywhere Studio package or see http://www.sybase.com/detail?id=1015780.

In this lesson, you call JDBCExamples.Query() from Interactive SQL, interrupt the execution in the debugger, and trace through the source code for this method.

The JDBCExamples.Query() method executes the following query against the sample database:

SELECT id, unit_price
FROM product

It then loops through all the rows of the result set, and returns the one with the highest unit price.

Compiling Java classes for debugging 

You must compile classes with the javac -g option in order to debug them. The sample classes are already compiled for debugging.


Prepare the database
Display Java source code in the debugger
Set a breakpoint
Run the method
Step through source code
Inspect and modify variables

Contents Index Confirm the diagnosis and fix the bug Prepare the database