[英]Jdbc connection class method setAutoCommit() behaviour
What will happen if we use setAutoCommit(true)
twice in Java class with oracle DB. 如果我们在带有Oracle DB的Java类中两次使用setAutoCommit(true)
将会发生什么。
try{
Connection conn = getConnection();
conn.setAutoCommit(true);
conn.setAutoCommit(true);
}catch (exception ex){
}
From Javadoc 从Javadoc
If setAutoCommit is called and the auto-commit mode is not changed, the call is a no-op. 如果调用setAutoCommit并且未更改自动提交模式,则该调用为无操作。
So if you call setAutoCommit()
with the same argument several times only first call will be executed. 因此,如果多次使用相同的参数调用setAutoCommit()
,则只会执行第一次调用。 All subsequent calls with the same argument will be ignored. 具有相同参数的所有后续调用将被忽略。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.