Procedure documentationUsing the SQLDBC Trace Locate this document in the navigation structure

 

The SQLDBC trace records the SQL statements that are sent by the application to the database via the SAP MaxDB SQLDBC interface, as well as their parameters and results.

Use the command line program sqldbc_cons to configure and control the SQLDBC trace.

Caution Caution

Traces compromise performance. Use traces only for troubleshooting and problem analysis.

End of the caution.

sqldbc_cons is a component of the SAP MaxDB SQLDBC software.

Procedure

Enter the following command on the command line:

<installation_path>\bin\sqldbc_cons [<command>] [<option>]

Note Note

You can display the installation path using the dbm_getpath DBM command:

dbmcli dbm_getpath InstallationPath

For more information, see Database Manager CLI, dbm_getpath.

End of the note.
SQLDBC Trace and ODBC Trace: Commands

<command>

Description

CONFIG TRACE FILENAME <trace_file_name>

Specifies the name <trace_file_name> of the trace file

If you enter %p in the name, it is replaced by the process ID of the application for which the trace is written.

PROFILE FILENAME <profile_file_name>

Specifies the name <profile_file_name> of the profile file

PROFILE [COLLECT ON | COLLECT OFF | RESET]

Activates or deactivates profiling (collecting statistical information) or resets all statistics counters

SHOW ALL

Displays the configuration of the traces and current information about the traces

SHOW CONFIG

Displays the configuration of the traces

SHOW PROFILE

Displays the collected statistical information in aggregated form

SHOW TRACESETTINGS

Displays current information about the traces

TRACE API ON | OFF

Applies only to the ODBC interface:

Activates or deactivates the API trace

The API trace is similar to the Microsoft Driver Manager trace, but logs more actions.

TRACE LONG ON | OFF

Activates/deactivates the detailed LONG trace

The LONG trace logs method calls with their call parameters.

TRACE OFF

Deactivates all SQLDBC traces

TRACE PACKET ON | OFF | <size>

Activates or deactivates the PACKET trace

The PACKET trace logs communication packages.

You use the <size> option to configure the size of the logged communication packages in bytes (default value: 1000 bytes).

TRACE SHORT ON | OFF

Activates or deactivates the SHORT trace

The SHORT trace logs method calls.

TRACE SIZE <size>

Defines the size <size> of the trace file (in bytes)

The system requires at least 8192 bytes for the trace file.

TRACE SQL ON | OFF

Activates or deactivates the SQL trace

The SQL trace logs SQL statements (the most simple trace is sufficient for most analyses).

TRACE STOP ON ERROR <error_number> | OFF [COUNT <number>]

Deactivates the trace after the error with error number <error_number> has occurred the number of times configured by the <number> option

TRACE TIMESTAMP ON | OFF

Activates or deactivates the time stamp for each logged action

SQLDBC Trace and ODBC Trace: Options

<option>

Description

Note that you can enter only one trace option at a time. They cannot be combined.

-f

Forces the execution of the command

-h

Displays help

-p <pid>

Executes the command only for the process with process ID <pid>.

-u <domain>\<os_user>

For Microsoft Windows only

To use this option, you need administration privileges on your computer.

With this option, you write the trace for the operating system user <os_user> of the <domain>. If you do not specify this option, the trace is written for the operating system user who is logged on.

You need this option, for example, to activate the trace in an SAP system where you cannot logon with the user SAPservice<SID>.

-v

Displays detailed information (verbose)

Result

The SQLDBC trace writes its results in chronological order into the sqldbctrace-<pid>.prt trace file in the <data_path>\wrk (Microsoft Windows) or <user_home>\.sdb\<computer_name> (Unix/Linux) directory.

If profiling has been activated, the SQLDBC trace writes aggregated statistical information to the sqldbcprofile-<pid>.prt file.

<pid> = process ID

The trace file is overwritten cyclically.

More information: Glossary, Directory

Example

  1. To activate the SQLDBC trace for SQL statements, enter the following command:

    C:\Program Files\sdb\Installation_2009-07-21\bin\sqldbc_cons TRACE SQL ON

  2. You use SQLCLI to log on to the DEMODB database as database user MONA and query the data in the HOTEL.HOTEL table.

    C:\Program Files\sdb\Installation_2009-07-21\bin\sqlcli -d DEMODB -u MONA,RED select * from HOTEL.HOTEL

  3. The SQLDBC trace writes the information to the trace file C:/ProgramData/sdb/Installation_2009-07-21/wrk/sqldbctrace-1236.prt:

    <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><PRE><PLAINTEXT>SQLDBC 7.8.2 BUILD 000-103-218-836 Aug 10 2009 20:11:18 System: Microsoft Windows / Intel x86 (32-bit) IFR_Environment::IFR_Environment >IFR_Environment::getConnection >IFR_Environment::getConnection <=&(conn -1 sess 00000000) <=&(conn -1 sess 00000000) >IFR_Connection::connect p_servernode(-3)=' ' p_serverdb(-3)='demodb' p_username(-3)='MONA'[...]

More Information

SAP Note 822239 (FAQ: MaxDB Interfaces)