开发者

ODBC hook / shim

I have an old app that I need to get functioning. Right now it uses some invalid SQL. It connects to the db using ODBC. I would just l开发者_JAVA百科ike to shim the ODBC so I could watch for the invalid SQL and replace it with some valid commands.

Any ideas?

MySQL proxy would fit the bill if it would fly over ODBC.

http://dev.mysql.com/downloads/mysql-proxy/


Easiest way is to write a shim yourself, and have the legacy app load your shim which then proxies all ODBC function calls except SQLPrepare and SQLExecDirect to the original ODBC driver. You can then alter any relevant SQL queries passed in through these two functions. All other functions pass arguments through unchanged.

You'll need to "install" your shim as an ODBC driver in the registry (if on Windows) under HKLM\SOFTWARE\ODBC\ODBCINST.INI (for the driver) and ODBC.INI (for the DSN). You can then point your old app to your shim, which will load the original driver dynamically.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜