如何找到在 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):
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.