User's Guide
PART 3. Java in the Database
CHAPTER 19. Debugging Java in the Database
With Java in the database, you can add complex classes into your database. In order to test these classes and to fix problems with them, you can use the Sybase Java debugger.
This chapter describes how to set up and use the Java debugger.
The Java debugger is a Java application that runs on a client machine. It connects to the database using the Sybase jConnect JDBC driver.
The debugger debugs classes running in the database. You can step through the source code for the files as long as you have the Java source code on the disk of your client machine. (Remember, the compiled classes are installed into the database, but the source code is not).
You need the following in order to use the Java debugger:
A Java runtime environment The Java debugger is a client application running on your machine. You need a Java runtime environment such as the Sun Microsystems Java Runtime Environment or the full Sun Microsystems JDK on your machine in order to run the debugger.
Sybase jConnect The debugger connects to the database using the Sybase jConnect JDBC driver. It requires features supported by jConnect that may not be supported by other JDBC drivers. Sybase jConnect is included with Adaptive Server Anywhere.
Source code You need the source code for your application on your client machine.
Permissions In order to use the debugger, you must either have DBA authority or be granted permissions in the SA_DEBUG group. This group is added to all databases when the database is created.
You can carry out many tasks with the Sybase Java debugger, including the following:
Trace execution Step line by line through the code of a class running in the database. You can also look up and down the stack of functions that have been called.
Set breakpoints Run the code until you hit a breakpoint, and stop at that point in the code.
Set break conditions Breakpoints include lines of code, but you can also specify conditions when the code is to break. For example, you can stop at a line the tenth time it is executed, or only if a variable has a particular value. You can also stop whenever a particular exception is thrown in the Java application.
Browse classes You can browse through the classes installed into the database.
Inspect and set variables You can inspect the values of variables alter their value when the execution is stopped at a breakpoint.
Inspect and break on expressions You can inspect the value of a wide variety of expressions.