开发者

Audit JDBC execute on JBossAS5

I use JBossAS5 and JDBC to connect database and want to log all JDBC execu开发者_Go百科ted SQL.

The data source is configured to JNDI resource in '-ds.xml' as JBossAS required.

I don't want to use DBMS itself to log SQL. In addition, the log operation should be transparent to business logic.

My approach: I wrote a proxy Driver class which implements java.sql.Driver and delegates the real driver class underlying. Then the proxy Driver is registered in -ds.xml.

Any suggestion? Thanks!


log4jdbc seems to be the current best-of-breed for this sort of thing, although I haven't tried it with JBoss's datasource descriptors yet.

Give it a try.

You really don't want to implement this yourself, though. There are a LOT of interfaces in JDBC that you'd need to implement.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜