Launching a Database Debug Session

Once breakpoints have been set, you can launch a Database Debug session in a number of ways. Similar to a launch configuration, a Database Debug session remembers the SQL statement each time you want to test your object. It addition, it allows you to examine and manipulate variables and parameters and execute procedural objects one breakpoint at a time.

Use one of three methods to launch a session: from the Database Development perspective, from the Eclipse toolbar, or from the context menu of SQL Editor.

To launch a Database Debug session from the Database Development perspective:

  1. Select an ASA or ASE stored procedure, ASA event, ASA user-defined function, or trigger that you want to debug. For triggers, expand a table in the Tables folder, then expand the Triggers folder to select the trigger that you want to debug.

  2. Use one of the following procedures, depending on what procedural object you are debugging:

    • Right-click the object you want to debug. Select one of the following: Debug Procedure, Debug Event, Debug Function, or Debug Trigger. The object's SQL code appears in SQL Editor. For stored procedures and events, the Configure Parameters dialog appears.

      1. If there are any parameters associated with the stored procedure or event, use the Configure Parameters dialog to change the values of parameters, then click OK.

      2. Click Yes to verify that you want to switch to the Debug perspective. The procedure executes up to the first breakpoint. Its status appears in SQL Results.

    • If the procedural object is a trigger, code displays in SQL Editor, and the Modify Attributes and Launch page appears.

      1. In the Run frame, add the SQL code to fire the trigger by using the SQL button to choose an insert, update, or delete command. The Select Tables dialog appears inside the Visual SQL dialog.

      2. Select the tables whose attributes you want to modify. Click Open. The Update (or Insert or Delete) Column Values pane appears. See Using Visual SQL to Edit a Procedural Object for further information.

      3. Select the column to modify and enter the values in the Values column, using the operators as needed. Click OK.

      4. Click OK in the Visual SQL dialog to return to the Modify Attributes and Launch page. Select Apply, then choose Debug to execute the SQL code. (See Running a Trigger for more information.) Database Debug suspends execution at the first breakpoint.

      5. Click Yes at the Confirm Perspective Switch dialog. The Debug perspective appears with the SQL code in SQL Editor, displaying breakpoints. Detailed information on the execution appears under the Debug tab in SQL Results view.

To launch a Database Debug session from the Eclipse Workbench Run menu:

  1. Select a stored procedure, ASA event, or ASA user-defined function that you want to debug. For triggers, expand a table in the Tables folder, then expand the Triggers folder to select the trigger to debug.

  2. Select Run|Debug from the Eclipse Workbench toolbar to invoke the Eclipse Launch Configuration wizard. The Create, Manage, and Run Configurations page appears.

  3. You can click Debug from here if you have no changes to make. Use the SQL button to add a statement to the procedure. Select a table and modify column values as in steps 1 - 3 above.

  4. Once you return to the Create, Manage, and Run Configurations page, create a new launch configuration by naming the new configuration in the Name field. Make any changes to the connection Profile field. To modify an existing name, browse the Object Name field. Configure parameters by pressing the Configure Parameters button and filling in the ensuing table.

  5. When you are done making changes, click Apply on the Create, Manage, and Run Configurations page.

  6. Click New. Your new configuration appears in the Configurations view.

  7. Click Debug. The SQL code executes, suspending execution at the first breakpoint. Click Yes to switch to the Database Debug perspective. The Debug perspective appears with the SQL code in SQL Editor, displaying any breakpoints.

To launch a Database Debug session from the SQL Editor context menu:

  1. With your procedural object code loaded in SQL Editor, right-click in SQL Editor and select Debug.

    The Configure Parameters table appears.

  2. Change values as permitted or click Load Defaults. Click OK.

  3. You are prompted by the Confirm Perspective Switch dialog to verify switching to Database Debug perspective. Click OK.

    The SQL code executes to the first breakpoint and the prespective changes to Database Debug.

Viewing SQL Results

Manipulating Breakpoints

Using Database Debug

Debugging a Procedural Object

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com