[英]JDBC RollBack After Connection Close
Say a connection is opened and auto commit is set to false to start a transaction. 假设连接已打开且自动提交设置为false以启动事务。 After the transaction is complete, I would like to rollback any changes to bring the database to the state it was before I started the transaction.
在事务完成之后,我想回滚任何更改以使数据库进入我开始事务之前的状态。
My problem is, that during the transaction the connection is closed, and thus all the changes are committed at that time. 我的问题是,在事务期间连接被关闭,因此所有更改都在那时提交。
Is there a way to rollback the state of the database to before the initial transaction started? 有没有办法在初始事务开始之前回滚数据库的状态?
and yes I've tried using Savepoints to no avail. 是的,我尝试使用Savepoints无济于事。
This really depends on what you're doing, why and how. 这实际上取决于你在做什么,为什么以及如何做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.