Usage for sqldbgr

Additional usage instructions for sqldbgr.

  • The sql command is executed in the context of debugged task, while the mysql command is executed in the context of debugger task. Setting session-specific information, such as for set quoted_identifier on through sql does not work.

  • By default, the SAP jConnect™ for JDBC driver uses set quoted_identifier on. Since the sqldbgr utility is built using jConnect arguments that need quotes, use single quotes instead of double quotes when entering options. For example, use sp_configure 'allow update' instead of sp_configure "allow update".

  • Before running sqldbgr, set either the SYBASE_JRE or JAVA_HOME environments to the location containing the Java run environment.

  • When you invoke sqldbgr at the command prompt, the utility starts and the prompt changes to a sqldbgr prompt:
    (sqldbgr)

    Once you see the (sqldbgr) prompt, enter these sqldbgr commands to perform your tasks:

sqldbgr commands and their descriptions are:

CommandDescription
attach spid

Attaches a task to sqldbgr when you are already logged in to an SAP ASE server.

Do not use attach spid to attach to a procedure that is not running.

sqldbgr cannot debug multiple tasks in the same session. If you try to attach the utility to multiple tasks, the first spid continues to be marked as attached. Since you cannot attach to a spid that is already attached, use the detach command, and then attach to another spid.

run procname

Debugs stored procedures and triggers without attaching sqldbgr to an existing task.

If you attempt to use run procname while you are already debugging an existing task with attach spid, run procname fails and you see:
Cannot run a procedure while debugging another task
stop in procname [at line #]

Sets a breakpoint to stop the stored procedure or trigger being debugged at the beginning of the specified procedure name.

stop in procname at line # sets a breakpoint to stop the stored procedure or trigger being debugged at a designated line within the specified procedure.

If you enter an invalid line number, sqldbgr moves the breakpoint to the next valid line number, and displays:
Invalid line number

You can also use this command to set multiple breakpoints.

show breakpoints

Displays the breakpoint handle in the form of a unique number, as well as the breakpoint statements given by the user during the sqldbgr session.

If you specify a breakpoint line number that does not contain a valid SQL statement, the SAP ASE server moves the breakpoint to the next valid line number. However, SAP ASE does not change the command you entered. This is why show breakpoints can return a breakpoint handle and a breakpoint statement given during the sqldbgr session that can be different.

An asterisk (*) in the breakpoint line indicates that the breakpoint is set, but currently disabled.

use dbname

Tells sqldbgr what database to use in order to debug that database’s stored procedures or triggers.

show variables [at level #]

Dsplays all the variables and their values in the current SQL stored procedure or trigger.

show variables at level # – displays the variables and their values in the current SQL stored procedure or trigger at the specified level.

Note: sqldbgr does not support Java variables.
show where

Displays the call stack of the stored procedures and triggers that exist in the task being debugged.

step or next

Instructs sqldbgr to move to the next statement in the current stored procedure or trigger.

step into

Instructs sqldbgr to move into a procedure if the current statement is an execute statement. If the current statement is an update, delete, or insert statement, and if there are triggers in it, step into instructs sqldbgr to move into the update, delete, or insert triggers.

step out

Instructs sqldbgr to move out of the current stored procedure or trigger, and to stop at the next line in the calling procedure.

set @varname = VALUE

Sets the value of the indicated variable to the variable value declared in the command in the current stored procedure or trigger. The values for the variables set using set @varname = VALUE are valid only for the current session sqldbgr.

cont[inue]

Instructs sqldbgr to continue debugging, and to stop at the next breakpoint (if any).

delete #

Deletes the indicated breakpoint set in the current instance of sqldbgr.

enable #

Enables the indicated breakpoints, while disable # does the opposite.

sql any_sql_statement

Executes ad hoc SQL statements. Use this command to select and analyze data from temp tables created by the task being debugged.

sql any_sql_statement returns a result set and any errors that occurred.

detach spid

Detaches sqldbgr from the indicated spid, and releases the task being debugged.

It deletes the breakpoints that were set for the task being debugged during the current sqldbgr session.

help [all]

Display sqldbgr commands.