简体   繁体   中英

How can I find all the SQL updates run in a Java Connection (from transaction start to commit)?

如何找到在 Java 连接中运行的所有 SQL 更新查询(从事务开始到提交)?

You can't do that with a normal Connection .

You could create wrapper classes for the actual Connection / Statement classes, that would track which statements have been executed. A better idea would be to just enable logging of SQL if your driver supports it, otherwise you're just recreating an existing functionality.

Some other options (on database level):

  • Enable and configure AUDITING; or
  • Enable SQL tracing of the relevant database session(s)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM