tags:

views:

1070

answers:

4

What is the best way to debug a custom ODBC driver on Windows? A former member of our team wrote the driver so we have the source available.

How do you attach a debugger to the driver? Or is it easier to just add "trace prints" to the driver to see what is going on?

+1  A: 

You can debug any ODBC driver by activating the logging for it via the Control Panel.

Just go to driver's properties, activate the logging and set the target log file - and then set up another program to read from it interactively, so you can see what's going on.

Milan Babuškov
A: 

As far as I know, ODBC drivers are just DLL's which implement a specific set of functions. So if you have the sources available, you can use Visual Studio to debug it. Here is an article which seems to be something in the right directions: Debugging DLL Projects in Visual Studio 2005.

Cd-MaN
A: 

Supportingly to VS you could use WireShark to see what the ODCB driver is sending to the DB.

Florian
+1  A: 

The best solution i found so far is a combination of trace prints and breakpoints (int 3) compiled into the driver.

Trace prints for general debug information and the breakpoints for pieces of the code where I need to more thoroughly investigate the inner state of the driver.

Mathias