This section describes how to use the ODBC Driver Manager Trace tool.
You can use the ODBC Driver Manager Trace tool to trace a connection to any ODBC data source that you access in InfoMaker through the ODBC interface.
Unlike the Database Trace tool, the ODBC Driver Manager Trace tool cannot trace connections through one of the native database interfaces.
What this tool does
ODBC Driver Manager Trace records information about ODBC API calls (such as SQLDriverConnect, SQLGetInfo, and SQLFetch) made by InfoMaker while connected to an ODBC data source. It writes this information to a default log file named SQL.LOG or to a log file that you specify.
What both tools do
The information from ODBC Driver Manager Trace, like Database Trace, can help you:
-
Understand what InfoMaker is doing internally while connected to an ODBC data source
-
Identify and resolve problems with your ODBC connection
-
Provide useful information to Technical Support if you call them for help with your database connection
When to use this tool
Use ODBC Driver Manager Trace instead of the Database Trace tool if you want more detailed information about the ODBC API calls made by InfoMaker.
Performance considerations
Turning on ODBC Driver Manager Trace can slow your performance while working in InfoMaker. Therefore, use ODBC Driver Manager Trace for debugging purposes only and keep it turned off when you are not debugging.
SQL.LOG file
InfoMaker writes ODBC Driver Manager Trace output to a default log file named SQL.LOG or to a log file that you specify. The default location of SQL.LOG is in your root directory.
To start ODBC Driver Manager Trace in order to trace your ODBC connection, you must edit your database profile.
To start ODBC Driver Manager Trace, edit the database profile for the connection you want to trace, as described in the following procedure.
To start ODBC Driver Manager Trace:
-
Open the Database Profile Setup-ODBC dialog box for the ODBC connection you want to trace.
-
On the Options tab, select the Trace ODBC API Calls check box.
-
(Optional) To specify a log file where you want InfoMaker to write the output of ODBC Driver Manager Trace, type the path name in the Trace File box.
or
(Optional) Click Browse to display the pathname of an existing log file in the Trace File box.
By default, if the Trace ODBC API Calls check box is selected and no trace file is specified, InfoMaker sends ODBC Driver Manager Trace output to the default SQL.LOG file.
-
Click OK or Apply.
or
Right-click on the connected database and select Re-connect from the dropdown menu in the Database Profiles dialog box.
The Database Profiles dialog box displays with the name of the edited profile highlighted.
InfoMaker saves your settings in the database profile entry in the registry in the HKEY_CURRENT_USER\Software\Sybase\PowerBuilder\18.0\DatabaseProfiles key.
For example, here is the relevant portion of a database profile entry for an ODBC data source named Employee. The settings that start ODBC Driver Manager Trace (corresponding to the ConnectOption DBParm parameter) are emphasized.
DBMS "ODBC" ... DbParm "ConnectString='DSN=Emloyee;UID=dba; PWD=00c61737',ConnectOption='SQL_OPT_TRACE,SQL_OPT_TRACE_ON;SQL_OPT_TRACEFILE,C:\Temp\odbctrce.log'"
-
Click Connect in the Database Profiles dialog box to connect to the database.
or
Right-click on the connected database and select Re-connect from the dropdown menu in the Database Profiles dialog box.
InfoMaker connects to the database, starts tracing the ODBC connection, and writes output to the log file you specified.
Once you start tracing an ODBC connection with ODBC Driver Manager Trace, InfoMaker continues sending trace output to the log file until you stop tracing. After you stop tracing as described in the following sections, you must reconnect to have the changes take effect.
To stop ODBC Driver Manager Trace:
-
Open the Database Profile Setup - ODBC dialog box for the connection you are tracing.
For instructions, see Starting ODBC Driver Manager Trace.
-
On the Options tab, clear the Trace ODBC API Calls check box.
If you supplied the pathname of a log file in the Trace File box, you can leave it specified in case you want to restart tracing later.
-
Click OK in the Database Profile Setup - ODBC dialog box.
The Database Profiles dialog box displays, with the name of the edited profile highlighted.
-
Click Connect in the Database Profiles dialog box.
or
Right-click on the connected database and select Re-connect from the dropdown menu in the Database Profiles dialog box.
InfoMaker connects to the database and stops tracing the connection.
You can display the contents of the ODBC Driver Manager Trace log file anytime during an InfoMaker session.
Location of SQL.LOG
For information about where to find the default SQL.LOG file, see About ODBC Driver Manager Trace.
To view the contents of the log file:
-
Open SQL.LOG or the log file you specified in one of the following ways:
-
Use the File Editor in InfoMaker. (For instructions, see the User's Guide.)
-
Use any text editor outside InfoMaker.
Leaving the log file open
If you leave the log file open as you work in InfoMaker, ODBC Driver Manager Trace does not update it.
This section shows a partial example of output from ODBC Driver Manager Trace to give you an idea of the information it provides. The example is part of the trace on an ODBC connection to the PB Demo DB.
For more about a particular ODBC API call, see your ODBC documentation.
PB100 179:192 EXIT SQLSetConnectOption with return code 0 (SQL_SUCCESS) HDBC 0x036e1300 UWORD 104 <SQL_OPT_TRACE> UDWORD 1 PB100 179:192 ENTER SQLSetConnectOption HDBC 0x036e1300 UWORD 105 <SQL_OPT_TRACEFILE> UDWORD 160694373PB100 179:192 EXIT SQLSetConnectOption with return code 0 (SQL_SUCCESS) HDBC 0x036e1300 UWORD 105 <SQL_OPT_TRACEFILE> UDWORD 160694373PB100 179:192 ENTER SQLDriverConnectW HDBC 0x036e1300 HWND 0x004607fa WCHAR * 0x1f4be068 [ -3] "******\ 0" SWORD -3 WCHAR * 0x1f4be068 SWORD 8 SWORD * 0x00000000 UWORD 1 <SQL_DRIVER_COMPLETE> PB100 179:192 EXIT SQLDriverConnectW with return code 0 (SQL_SUCCESS) HDBC 0x036e1300 HWND 0x004607fa WCHAR * 0x1f4be068 [ -3] "******\ 0" SWORD -3 WCHAR * 0x1f4be068 SWORD 8 SWORD * 0x00000000 UWORD 1 <SQL_DRIVER_COMPLETE> PB100 179:192 ENTER SQLGetInfoW HDBC 0x036e1300 UWORD 6 <SQL_DRIVER_NAME> PTR 0x036e2098 SWORD 6 SWORD * 0x0012cd30PB100 179:192 EXIT SQLGetInfoW with return code 1 (SQL_SUCCESS_WITH_INFO) HDBC 0x036e1300 UWORD 6 <SQL_DRIVER_NAME> PTR 0x036e2098 [ 6] "DB\ 0" SWORD 6 SWORD * 0x0012cd30 (22) DIAG [01004] [Sybase][ODBC Driver]Data truncated (0) PB100 179:192 ENTER SQLGetInfoW HDBC 0x036e1300 UWORD 10 <SQL_ODBC_VER> PTR 0x036e39f8 SWORD 100 SWORD * 0x0012cd38PB100 179:192 EXIT SQLGetInfoW with return code 0 (SQL_SUCCESS) HDBC 0x036e1300 UWORD 10 <SQL_ODBC_VER> PTR 0x036e39f8 [ 20] "03.51.0000" SWORD 100 SWORD * 0x0012cd38 (20) PB100 179:192 ENTER SQLGetInfoW HDBC 0x036e1300 UWORD 2 <SQL_DATA_SOURCE_NAME> PTR 0x036e3c88 SWORD 512 SWORD * 0x0012cc32PB100 179:192 EXIT SQLGetInfoW with return code 0 (SQL_SUCCESS) HDBC 0x036e1300 UWORD 2 <SQL_DATA_SOURCE_NAME> PTR 0x036e3c88 [ 28] "PB Demo DB V4" SWORD 512 SWORD * 0x0012cc32 (28) PB100 179:192 ENTER SQLGetInfoW HDBC 0x036e1300 UWORD 16 <SQL_DATABASE_NAME> PTR 0x036e3c88 SWORD 512 SWORD * 0x0012cc32PB100 179:192 EXIT SQLGetInfoW with return code 0 (SQL_SUCCESS) HDBC 0x036e1300 UWORD 16 <SQL_DATABASE_NAME> PTR 0x036e3c88 [ 16] "easdemo4" SWORD 512 SWORD * 0x0012cc32 (16) PB100 179:192 ENTER SQLGetInfoW HDBC 0x036e1300 UWORD 25 <SQL_DATA_SOURCE_READ_ONLY> PTR 0x036e3c88 SWORD 512 SWORD * 0x0012cc32PB100 179:192 EXIT SQLGetInfoW with return code 0 (SQL_SUCCESS) HDBC 0x036e1300 UWORD 25 <SQL_DATA_SOURCE_READ_ONLY> PTR 0x036e3c88 [ 2] "N" SWORD 512 SWORD * 0x0012cc32 (2) PB100 179:192 ENTER SQLGetInfoW HDBC 0x036e1300 UWORD 13 <SQL_SERVER_NAME> PTR 0x036e3c88 SWORD 512 SWORD * 0x0012cc32PB100 179:192 EXIT SQLGetInfoW with return code 0 (SQL_SUCCESS) HDBC 0x036e1300 UWORD 13 <SQL_SERVER_NAME> PTR 0x036e3c88 [ 16] "easdemo4" SWORD 512 SWORD * 0x0012cc32 (16) PB100 179:192 ENTER SQLGetInfoW HDBC 0x036e1300 UWORD 17 <SQL_DBMS_NAME> PTR 0x036e3c88 SWORD 512 SWORD * 0x0012cab6PB100 179:192 EXIT SQLGetInfoW with return code 0 (SQL_SUCCESS) HDBC 0x036e1300 UWORD 17 <SQL_DBMS_NAME> PTR 0x036e3c88 [ 48] "SQL Anywhere" SWORD 512 SWORD * 0x0012cab6 (48) PB100 179:192 ENTER SQLGetInfoW HDBC 0x036e1300 UWORD 6 <SQL_DRIVER_NAME> PTR 0x036e1a10 SWORD 550 SWORD * 0x0012cbbcPB100 179:192 EXIT SQLGetInfoW with return code 0 (SQL_SUCCESS) HDBC 0x036e1300 UWORD 6 <SQL_DRIVER_NAME> PTR 0x036e1a10 [ 22] "DBODBC7.DLL" SWORD 550 SWORD * 0x0012cbbc (22) PB100 179:192 ENTER SQLAllocStmt HDBC 0x036e1300 HSTMT * 0x0012d0b4 PB100 179:192 EXIT SQLAllocStmt with return code 0 (SQL_SUCCESS) HDBC 0x036e1300 HSTMT * 0x0012d0b4 ( 0x036e1c48) PB100 179:192 ENTER SQLGetTypeInfo HSTMT 0x036e1c48 SWORD 0 <SQL_ALL_TYPES>