jdbc 事务commit之后还能rollback吗
比如条件1mydb.rollback();。。。。条件2mydb.rollback();mydb.commit();这样条件1和条件2的还会回滚吗...
比如
条件1
mydb.rollback();
。。。。
条件2
mydb.rollback();
mydb.commit();
这样条件1和条件2的还会回滚吗 展开
条件1
mydb.rollback();
。。。。
条件2
mydb.rollback();
mydb.commit();
这样条件1和条件2的还会回滚吗 展开
展开全部
不可以同时用
如果要rollback,必须设置
conn.setAutoCommit (false);
void java.sql.Connection.setAutoCommit(boolean
autoCommit) throws SQLException
Sets this connection's auto-commit mode to the given state. If a connection
is in auto-commit mode, then all its SQL statements will be executed and
committed as individual transactions. Otherwise, its SQL statements are grouped
into transactions that are terminated by a call to either the method
commit or the method rollback. By default, new
connections are in auto-commit mode.
如果要rollback,必须设置
conn.setAutoCommit (false);
void java.sql.Connection.setAutoCommit(boolean
autoCommit) throws SQLException
Sets this connection's auto-commit mode to the given state. If a connection
is in auto-commit mode, then all its SQL statements will be executed and
committed as individual transactions. Otherwise, its SQL statements are grouped
into transactions that are terminated by a call to either the method
commit or the method rollback. By default, new
connections are in auto-commit mode.
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
请认真理解这句话:结束事务的标志是提交或回滚。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询