60
by mysqldev
- Updated build files to reflect that "MYODBCDbgGetFileDefault.c" was removed. |
1 |
+-------------------------------------------------------------+ |
2 |
| Connector/ODBC | |
|
3 |
| Debug | |
|
4 |
+-------------------------------------------------------------+ |
|
5 |
||
6 |
||
7 |
INTRODUCTION
|
|
8 |
---------------------------------------------------------------
|
|
9 |
||
10 |
This brief document describes some methods to debug a problem |
|
11 |
in the driver - it is hoped to be useful to experienced |
|
12 |
programmers - particularly driver developers. |
|
13 |
||
14 |
Debugging the driver can be done in a number of ways but is |
|
15 |
not usually done by stepping through the source code in debug |
|
16 |
mode of gdb or an IDE for example. The most common method is to |
|
447.1.119
by jwinstead
Remove out-of-date information |
17 |
get the driver manager to produce trace information showing the |
18 |
calls being made, the return codes and other useful information. |
|
60
by mysqldev
- Updated build files to reflect that "MYODBCDbgGetFileDefault.c" was removed. |
19 |
|
20 |
||
21 |
COMPILER DEBUG INFORMATION |
|
22 |
---------------------------------------------------------------
|
|
23 |
||
24 |
As usual; the driver can be built with or without compiler |
|
25 |
generated debugging information. In practice; this is not the |
|
26 |
most common method to debug problems with the driver. |
|
27 |
||
28 |
This is independent of any of the trace options listed here. |
|
29 |
||
30 |
||
31 |
ODBC TRACE |
|
32 |
---------------------------------------------------------------
|
|
33 |
||
34 |
If you are using a Driver Manager (DM) - and most people do - |
|
35 |
then you can turn on ODBC Trace. An ODBC Trace will produce a |
|
36 |
file which shows all of the ODBC calls being made and some very |
|
37 |
useful details. |
|
38 |
||
39 |
ODBC Trace is particularly useful to see the interaction between |
|
40 |
the application and the DM. In some cases an application may be |
|
41 |
using software layered on top of ODBC (ADO for example) and in |
|
42 |
this case ODBC Trace is the best way to see how that intermediate |
|
43 |
layer is interacting with ODBC. |
|
44 |
||
45 |
ODBC Trace can be turned on/off using the ODBC Administrator. |
|
46 |
||
47 |
MS Windows |
|
48 |
----------
|
|
49 |
||
50 |
Invoke the ODBC Administrator from the Start menu; |
|
51 |
||
52 |
Start -> Control Panel -> Administrative Tools -> ODBC Administrator |
|
53 |
||
54 |
Use the options on the Trace tab to turn tracing on/off. |
|
55 |
||
56 |
NOTE: You should close the ODBC Administrator program to ensure |
|
57 |
that the changes have taken affect - Apply/Ok is not always |
|
58 |
enough. |
|
59 |
||
60 |
unixODBC
|
|
61 |
--------
|
|
62 |
||
63 |
Invoke the ODBCConfig GUI. This can be done from the command-line |
|
64 |
in a shell. Turn ODBC Trace on/off and close the application. |
|
65 |
||
66 |
||
67 |
FLAG_LOG_QUERY
|
|
68 |
--------------
|
|
69 |
||
70 |
This is a DSN config option which can be set to turn on feature |
|
71 |
to log queries to a file. |
|
72 |
||
73 |
The location of the trace output is dependent upon the |
|
74 |
DRIVER_QUERY_LOGFILE const. |
|
75 |
||
76 |
This option may be presented as "Save Queries to" in the |
|
77 |
DSN edit. |
|
78 |
||
79 |
This is meaningless if DBUG_OFF has been set at build-time. |
|
80 |
||
81 |
DRIVER_QUERY_LOGFILE
|
|
82 |
--------------------
|
|
83 |
||
84 |
This is a hardcoded file location/name for the query log. |
|
85 |
||
86 |
WIN : "c:\\myodbc.sql" |
|
87 |
UNIX: "/tmp/myodbc.sql" |
|
88 |
||
89 |
||
90 |
SQL_OPT_TRACE
|
|
91 |
-------------
|
|
92 |
||
93 |
This connection attribute is implemented in the Driver Manager. |
|
94 |
||
95 |
SQL_OPT_TRACEFILE
|
|
96 |
-----------------
|
|
97 |
||
98 |
This connection attribute is implemented in the Driver Manager. |