How to Collect SQLDBC Trace?
The user is facing an issue while using the SAP HANA SQLDBC interface or an interface which is based on it and therefore were requested to provide SQLDBC trace of the reproduction scenario.
SOLUTION
Please use hdbsqldbc_cons in order to trace applications based on SQLDBC.
By default this hdbsqldbc_cons is installed together with the HANA client. You can find it at /usr/sap/hdbclient on linux/unix platforms and C:Program Filessaphdbclient or C:Program Files (x86)saphdbclient on Windows.
User should always specify following parameters while calling hdbsqldbc_cons:
1) hdbsqldbc_cons show all - the current trace settings are displayed
2) hdbsqldbc_cons trace <level> on - activates trace of specified level, possible levels are:
- debug: detailed tracing of whole call stack
- sql: tracing sql commands as well as output and parameter handling
- packet: tracing packets exchanged b/w client and server
- distribution: tracing distribution connections and errors 'Session has been reconnected'
(Available in Revision 111 and Revision 102.4 clients, and higher)
- hdbsqldbc_cons trace <level> off - deactivates trace for specified level
- hdbsqldbc_cons trace off - deactivates all trace levels at once
- hdbsqldbc_cons config trace filename <tracefile name> - please sets the trace file name to the path specified; %p in the name is replaced with the process ID. While it is possible for multiple processes to use the same trace file, it is highly recommended to include %p in order to have each process write its own trace file.
For further trace options, Please call hdbsqldbc_cons with option -h in order to receive a comprehensive list of all features.
In case if there are no traces written at all, this might be the result of some typical pitfalls:
- What interface is used by the application you would like to trace? hdbsqldbc_cons only applies to SQLDBC. Use hdbodbc_cons for ODBC applications.
- Did you enable tracing on the correct machine? Especially if several apps servers are used, you have to determine on which the application is running.
- Is the user running hdbsqldbc_cons the same user that runs the application to be traced?
- Does the trace tool have the same version as the driver (hdbsqldbc_cons version should correspond to libSQLDBCHDB.so)? This is normally not necessary, but sometimes it helps.
- Did the user the specify a trace file location in which the respective user is allowed to write files and which is reachable for the application?
- Did you look for the trace file in the correct directory? The trace-file name is relative, so trace will be written to the working directory of the application. Can you try to specify an absolute path?
- Did you include ‘%p’ in the trace file name (e.g. “SQLDBC-%p.txt”)? Otherwise, if multiple processes is using the interface, e.g. R/3, then only the first process can write into the tracefile and you will receive a tracefile that might not contain what you intended to trace. Please note that the trace file path might be overloaded by ABAP profile parameters. In this case, you will find the tracefiles in the instance’s work directory.
These following questions below are only valid for Microsoft Windows:
- Did you use the –u option in order to specify the user for which the trace is enabled as SAPservice<SID>?
- Does your user have admin privileges? in order to change trace settings for other users which means using the –u option, admin privileges are required. In this scenario, call hdbsqldbc_cons from a new shell (started with the ‘Run as administrator’ option).