Reputation: 12694
Is there a tool for windows that we can use to inspect any SQL commands that go through a particular ODBC data source?
Upvotes: 2
Views: 781
Reputation: 23148
You can make ODBC log out everything it's doing:
When you start tracing from the Tracing tab, the Driver Manager will log all ODBC function calls for all subsequently run applications. ODBC function calls from applications that are running before tracing is started are not logged.
- If it is necessary, log on using an account that has membership in the Local Administrators' group.
- From Administrative Tools, open the ODBC Data Source Administrator.
- Click the Tracing tab.
- Configure the tracing mode using the Machine-Wide tracing for all user identities check box:
- To enable machine-wide tracing, select the check box.
- To return to per-user tracing, clear the check box.
- Click Apply.
http://msdn.microsoft.com/en-us/library/ms711020%28VS.85%29.aspx
Note that:
When you start tracing from the Tracing tab, the Driver Manager will log all ODBC function calls for all subsequently run applications. ODBC function calls from applications that are running before tracing is started are not logged.
You can also do it programmatically:
... One can do this by calling
SQLSetConnectAttr
and set theSQL_ATTR_TRACE
attribute in the connection toSQL_OPT_TRACE_ON
. So, by doing this you would be enabling/disabling it for the connection duration.http://decipherinfosys.wordpress.com/2009/01/17/odbc-tracing/
Upvotes: 5
Reputation: 29051
If you're using SQL Server, look at the SQL Server Profiler. Profiler allows you to monitor/trace all communications between your application and the SQL Server, including which procedures are called, parameter values, etc, without having to modify your application.
If you're using a different server, you should be able to find a sql proxy that will do the same thing.
Upvotes: 0