Rational Developer for System z


< Previous | Next >

Debugging the stored procedure

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:

  1. 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.
    1. Set up the server for debugging.

    2. 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
    3. Open the batch file and edit as needed to reflect your particular install path, CLASSPATH, and port settings.
    4. Run thedb2dbgm.bat file to start the local (client) session manager.
    5. 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.
    6. In Rational Developer for System z, select from the main menu Window > Preferences, and expand Run/Debug > Routine Debugger > DB2 > SQL and Java.
    7. In the right panel, select Use already running session manager, and enter the IP address and port number for the session manager.
    8. Optional: Modify session timeout and other settings.
    9. Click OK to save your settings and close the Preferences window.
  2. In the routine editor, double-click in the left vertical margin to set line breakpoints at any line.
  3. 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.
  4. 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.
  5. Click OK. A prompt asks if you want to switch to the Debug perspective. Click Yes.
  6. From the Run menu, select Resume, Step into, or Step over to run in debug mode.
  7. 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.
< Previous | Next >

Terms of use | Feedback



This information center is powered by Eclipse technology. (http://www.eclipse.org)