Tracing and debuging ODBC

Home | Search | Hardware | Games | Software | Links | Computer Terms | Modem

Getting a ODBC log on calls that ODBC is making and to get the errors that are being
generated you need to create a log file.In addition you can also create a debug file as
well.

How to create a SQL.LOG file

1- Go to the Control panel

2- Find the ODBC32 icon in the control panel and double click on it

3-find and click on the tab Tracing 

4-You will see Start Tracing Now
Note:Also notice the log file path this is \sql.log 
the default setting, this is where the SQL.log file will be placed the \ means
root, you will find the sql.log in the root of C :\>sql.log

5-After click on Start Tracing Now you will see the button change to
   Stop Tracing Now at this point you start you application and connect
   and query after you have finished and disconnected you need to
   go back and Stop Tracing Now
   Warning: If you leave the tracing set to Start Tracing Now and you
    Don't Stop the tracing the sql.log  file will fill up your hard drive We
    have seen 70-80 meg+ trace file so watch out .

  6- after completing the trace go to the root directory and open the SQL.log
       file you can use note pad or word to edit


Warning: The following steps require you to edit the registry, If you are not formiler
               with the the registry back it up first or have some one walk you threw the
               steps

 
How to create a DEBUG file

Note: In most cases it is best to create a new Data source name in ODBC
          and add the debug entry in to the registry for that entry because every
          time you run a application to that source you be creating a Debug file.


1- Start regedit

2- Go to
HKEY_LOCAL_MACHINE -->Software-->ODBC-->ODBC.INI-->
you will then see a folder with your server connection entry name
click on the folder

3- On the right hand side place the mouse pointer and then click the right mouse button
     you will see a little dialog box pop up that says new in this case we want a string value
     the name will be DeBugFile the press the Enter Key on your keyboard
   

4- The next step double click on the DeBugFile string you just created a Edit String dialog
     Box will pop up at the bottom you will see a line that says Value data: add the following
     line c:\debug.log

5- Close regedit and run your application you will see a debug screen when your application
     is running as well as generating a debug log file you can use note pad or word to edit the
     file.