How to Inspect ODBC communication, to see the SQL being passed through?
Is there a tool for windows that we can use to inspect any SQL commands tha开发者_如何转开发t go through a particular ODBC data source?
You can make ODBC log out everything it's doing:
http://support.microsoft.com/kb/274551
http://msdn.microsoft.com/en-us/library/ms711020%28VS.85%29.aspx
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/
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.
精彩评论