sqldbgr is a command-line utility that debugs stored procedures and triggers. As with many source-level debuggers, you can:
attach sqldbgr to a task
set, enable, and disable breakpoints
step through a task one line at a time
step into and out of procedures
detach sqldbgr from stored procedures or triggers once the debugging is complete.
UNIX platforms sqldbgr is located in $SYBASE/$SYBASE_ASE/bin.
Windows sqldbgr is located in %SYBASE%\%SYBASE_ASE%\bin.
You do not have the ability to view sqldbgr version strings.
sqldbgr -U username -P password -S host:port
specifies the user name. You must insert a space between -U and username.
specifies the user password. You must insert a space between -P and password.
specifies the machine name and the port number. You must insert a space between -S and host:port.
Shows sqldbgr debugging stored procedures and triggers on host MERCURY:
$SYBASE/$SYBASE_ASE/bin/sqldbgr -U sa -P -S MERCURY:16896
(sqldbg) stop in sp_who Breakpoint moved to line 20 (sqldbg) run sp_who (sp_who::20)if @@trancount = 0 (sqldbg) next (sp_who::22) set chained off (sqldbg) cont fid spid status loginame origname hostname blk_spid dbname cmd block_xloid 0 2 sleeping NULL NULL 0 master NETWORK HANDLER 0 0 3 sleeping NULL NULL 0 master NETWORK HANDLER 0 0 4 sleeping NULL NULL 0 master DEADLOCK TUNE 0 0 5 sleeping NULL NULL 0 master MIRROR HANDLER 0 0 6 sleeping NULL NULL 0 master ASTC HANDLER 0 0 7 sleeping NULL NULL 0 master ASTC HANDLER 0 0 8 sleeping NULL NULL 0 master CHECKPOINT SLEEP 0 0 9 sleeping NULL NULL 0 master HOUSEKEEPER 0 0 10 running sa sa 0 master SELECT 0 0 11 sleeping sa sa (sqldbg) show breakpoints 1 stop in sp_who (sqldbg)
In this example, the System Administrator first logs in to Adaptive Server using isql, then starts sqldbgr from the command line to debug a stored procedure that is running in another task:
$SYBASE/$SYBASE_OCS/bin/isql -U sa -P 1> select @@spid 2> go ------ 12 1>
$SYBASE/$SYBASE_ASE/bin/sqldbgr -U sa -P -S MERCURY:16896
(sqldbg) attach 13 The spid is invalid (sqldbg) attach 12 (sqldbg) show breakpoints (sqldbg) stop in sp_who Breakpoint moved to line 20 (sqldbg) /* at this point run the sp_who procedure from spid 12 */ (sqldbg) where (sp_who::20::@loginname = <NULL>) (ADHOC::1::null) (sqldbg) next (sp_who::22) set chained off (sqldbg) next (sp_who::25)set transaction isolation level 1 (sqldbg) cont (sqldbg) /* at this point the sp_who result will show up in the isql screen */ (sqldbg) detach 12 (sqldbg)
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 Sybase jConnect 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 you can run sqldbgr, you must 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,
you can enter the following sqldbgr commands
to perform your tasks:
Table 8-4 lists all of sqldbgr’s error messages:
Copyright © 2005. Sybase Inc. All rights reserved. |