IBM DB2 Manual page 196

Table of Contents

Advertisement

Test your routine as a stand-alone program
Before you invoke your Java routines from SQL applications, it is a good idea to
run the routines as stand-alone programs, which are easier to debug. A Java
program that runs as a routine requires only a DB2 package. However, before you
can run the program as a stand-alone program, you need to bind a DB2 plan for it.
Use the DB2 Unified Debugger (stored procedures only)
The DB2 Unified Debugger is available with DB2 Database for Linux, UNIX, and
Windows. The DB2 Unified Debugger provides a GUI interface for debugging Java
stored procedures. Information on the DB2 Unified Debugger is available in the
DB2 Database for Linux, UNIX, and Windows information center, at
http://publib.boulder.ibm.com/infocenter/db2help.
To set up a DB2 for z/OS subsystem to work with the DB2 Unified Debugger,
when you set up your stored procedure environment, follow these additional steps:
1. Customize and run the DSNTIJSD program to define stored procedures that
2. Define the stored procedure that you intend to test with the ALLOW DEBUG
3. When you prepare the stored procedure for execution, specify the -g option in
4. Grant the DEBUGSESSION privilege to the user who runs the debug client.
5. Make the following modifications to the WLM environment for the stored
Enable collection of DB2 debug information
Include a JSPDEBUG DD statement in your startup procedure for the stored
procedure address space. This DD statement specifies a data set to which DB2
writes debug information for use by IBM Software Support.
Write your own debug information from your routine
A useful technique for debugging is to include System.out.println and
System.err.println calls in your program to write messages to the STDERR and
STDOUT files.
180
Application Programming Guide and Reference for Java
provide server support for the DB2 Unified Debugger.
DSNTIJSD is in the prefix.SDSNSAMP data set. The job prolog contains
customization instructions.
MODE option in the CREATE PROCEDURE or ALTER PROCEDURE
statement.
the javac command
-g causes the compiler to generate all debugging information for the program..
procedure:
v In the WLM environment startup procedure, set NUMTCB=1
v In the WLM environment startup procedure, include a PSMDEBUG DD
statement to direct the debug diagnostic log to a data set. You can allocate to
a SYSOUT data set or to a preallocated data set. The data set needs to be
created with the RECFM=VBA and LRECL=4096 characteristics.
v In the ENVAR settings in the JAVAENV data set, set USE_LIBJVM_G=YES.
v If the debug port range of 8000::8050 is not acceptable, in the ENVAR
settings in the JAVAENV data set, set JVM_DEBUG_PORTRANGE to the
range of ports that the JVM listens on for debug connections.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents