....
Connection con = null;
Statement st = null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("...","...","...");
//设置事物处理
con.setAutoCommit(false);
st = ct.createStatement();
st.executeUpdate("update...");
st.executeUpdate("update...");
con.commit();
}catch(Exception e){
con.rollback();
//回滚之后要不要再commit下?
e.printStackTrace();
}finally{
st.close();
con.close();
}
不需要
https://bbs.youkuaiyun.com/topics/380024065
提交后回滚可以吗?解决方案
------解决方案--------------------------------------------------------1、虚拟机; 2、搭建e69da5e887aa3231313335323631343130323136353331333332636334测试环境; 3、先备份数据库,测试完再还原; ------解决方案--------------------------------------------------------看flashback功能开起来没有,开起来的话直接闪回就好了 ------解决方案--------------------------------------------------------flashback 或者冷备份 ------解决方案--------------------------------------------------------如果开了闪回就可以,没开的话 alter database flashback on; ------解决方案--------------------------------------------------------flashback ------解决方案--------------------------------------------------------
对于一个事物来说,你提交后就没有所谓的回滚了,只能在提交前回滚。
911

被折叠的 条评论
为什么被折叠?



