The workbench includes an integrated stored procedure debugger
which supports debugging SQL or Java™ stored
procedures, with some limitations depending on your operating system
and DB2® version. See the stored
procedure debugger help topics in the information center for more
details.
To debug the stored procedure:
- Set up the debugger by starting with the server and session
manager. The session manager connects the debugger user
interface to the DB2 server
and must be running before the debug session can start.
- Set
up the server for debugging.
- Locate the local session manager start batch file. This
file, db2dbgm.bat, is located in the /bin subdirectory
of the root installation directory. For example, if Rational® Developer for System z® was installed in the
default directories, this directory would be located:
C:\Program
Files\IBM\SDP\bin
/opt/IBM/SDP/bin
- Open the batch file and edit as needed to reflect your
particular install path, CLASSPATH, and port settings.
- Run thedb2dbgm.bat file to start the
local (client) session manager.
- Note the IP address and port of the session manager
daemon in the command window that opens. You will need
to enter this information into the DB2 Stored
Procedure Debugger Preferences window.
- In Rational Developer
for System z, select from
the main menu , and expand Run/Debug > Routine
Debugger > DB2 > SQL
and Java.
- In the right panel, select Use already running
session manager, and enter the IP address and port number
for the session manager.
- Optional: Modify session timeout and other settings.
- Click OK to save your settings
and close the Preferences window.
- In the routine editor, double-click in the left vertical
margin to set line breakpoints at any line.
- In the Data Project Explorer view, right-click the stored
procedure, and select Debug. The Specify
Parameter Values window opens.
Tip: If, when
you attempt to debug, you get an error stating that the session manager
is not available, end the current session manager you have running
in the command prompt and restart it. Leave the command prompt open
with the running session manager and repeat step 3.
- In the Value field, type D11. D11 is the ID for a department (EMPLOYEE.WORKDEPT) in the EMPLOYEE
table. When you enter this value, the stored procedure will return
rows that match this department ID.
- Click OK. A prompt
asks if you want to switch to the Debug perspective. Click Yes.
- From the Run menu, select Resume, Step
into, or Step over to run in debug
mode.
- Continue running in debug mode until the results appear
in the SQL Results view.
You can return to the Data perspective by clicking the

button in
the top-right corner of the workbench and selecting
Data.