ODBC Trace
Note:The Mimer ODBC Trace tool is only available on 32 bit Windows.
Mimer ODBC Trace is a tool for getting the details out of an ODBC session. It can for example be used for debugging, monitoring and analyzing purposes. For each ODBC statement the tool can trace:
•the elapsed time in server
•the SQL statement used (if appropriate)
•the ODBC function used
•the timestamp for the ODBC call
•the ODBC handle used
•the calling application process ID and name
•the return code for the ODBC call
This software consists of two parts, the Mimer ODBC Trace Administration tool and the Mimer ODBC Trace DLL that substitutes the standard Microsoft ODBC Trace DLL.
The administration tool has two main functions:
•Configuration - to setup prerequisites for the trace logging and to start/stop logging
•Presentation - to select and display the records from a logging file.
To use the Mimer ODBC Trace DLL, it must first be activated using the administration tool.
Before using this software however, you should read Important Notes.
When starting the administration tool, the following dialog is displayed.
The left side of the window is the Configuration part, which is used to change the settings for the logging.
The two list boxes are used to manage which functions calls are to be logged, and which are not. Calls to functions present in the left list box will not be logged, and calls to functions present in the right list box will be logged.
The Enable>> button moves any selected function(s) in the left list box over to the right, thus activating logging of calls to that/those function(s).
The <<Disable button moves any selected function(s) in the right list box over to the left, thus deactivating logging of calls to that/those function(s).
The Log file Path edit field is where you specify the location of the generated log file(s). The path must exist for logging to be conducted successfully.
The radio button Mimer ODBC Trace specifies that the Mimer ODBC Trace DLL should be used instead of the default Microsoft ODBC Trace DLL. There is also a radio button Microsoft ODBC Trace, which can be used to switch back. See also Important Notes.
The Apply button saves any changes to the fields described above.
The Cancel button dismisses the dialog without saving any changes you have made and that are not applied.
The OK button save any changes you might have made, and dismisses the dialog.
After pressing the Start Tracing Now button (renames to Stop Tracing Now), logging will take effect for all applications attaching to the DLL. As the settings only will be read when the DLL is loaded, already started applications will not be affected.
Each started application will have a log file of its own, placed in the location specified by Log file Path and named mimodbctrac-applname-mmdd-hhmm.xml.
Pressing the Stop Tracing Now button (renames to Start Tracing Now) means that no logging will take place for applications started afterwards.
Note:Already running applications will continue logging until they quit. When an application ends, its log file is closed and becomes available for presentation.
The right side of the main window is the Presentation part (as showed below). It is used to present results from a selected log file, that has been produced by the Mimer ODBC Trace DLL.
First of all you have to find a Mimer ODBC Trace log file by using the button Select Logfile. Then you get a new window Select Log File, where you should choose a file, which is named according to the output from the DLL, i.e. mimodbctrac-applname-mmdd-hhmm.xml. When selected the name will be displayed in the field XML Logfile.
Next a presentation form should be selected from the XSL files menu. When a XSL file is selected the Display button should be pressed and the presentation will be shown.
Currently there are 3 different predefined presentations:
odbclog.xsl
Shows all information from the log file. Functions, which used more time than 0.01 seconds are displayed with the time in red color.
sqlstm.xsl
Shows all SQL statements found in the log file.
timgt1hs.xsl
Shows all functions, which used more time than 0.01 seconds.
Example odbclog.xsl:
Timestamp |
Function |
UsedTime |
Application (Processid:Threadid) |
Handle [id] |
Return code |
SQL-statement |
---|---|---|---|---|---|---|
2003-12-11 15:28:29.60 |
SQLAllocStmt |
0.0001 |
wsql |
HDBC[0x028f0280] |
SQL_SUCCESS |
|
2003-12-11 15:28:29.93 |
SQLPrepare |
0.2296 |
wsql |
HSTMT[ 0x028f0acc] |
SQL_SUCCESS |
select P from JSP |
Example sqlstm.xsl:
SQL-statements |
---|
SELECT DISTINCT P FROM SPJ, S, J WHERE SPJ.S = S.S AND SPJ.J = J.J AND S.CITY = J.CITY |
Example timgt1hs.xsl:
Timestamp |
Function |
UsedTime |
SQL-statement |
---|---|---|---|
2003-12-11 15:28:29.93 |
SQLPrepare |
0.1675 |
SELECT DISTINCT P FROM SPJ, S, J WHERE SPJ.S = S.S AND SPJ.J = J.J AND S.CITY = J.CITY |
Additional XSL files can be added to the default XSL file location.
The distributed XSL files may, for example, be modified, and replaced or stored as a new XSL file in the same location. Maybe other time limits are desired, or other colors, or others.
If for example, other time limits are wanted, the distributed XSL files may be modified and replaced or stored as a new XSL file in the same location.
•When changing any settings using the administration tool, you should restart any application for which you want the changes to be used. The reason for this is that the settings will only be read when the DLL is loaded by the application, and thus the DLL has to be reloaded for any changes to take effect.
•The administration tool changes the registry entries in HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI\ODBC
If there is any problem look there in order to see if your changes are applied.
•The “original” ODBC Administrator may also change those registry entries. Currently there is a problem concerning the cooperating use between these two administration tools. Watch out which DLL is selected, as both administrators may start or stop tracing with anyone of the DLL’s.