可以说我的代码大致类似于这样的东西:(使用oracle 10G jdbc)。交易是否会在这种特定的情况下进行?Oracle JDBC自动提交
public void someMethod(){
try {
OracleConnection connection = getConnectionFromPool();
connection.setAutoCommit(false);
// Do some transaction here - complete transaction, no errors occurred
...
//Throw my own exception here
throw new Exception("Custom Exception");
} catch (Exception e}
{
...
}
finally {
connection.setAutoCommit(true);
}
}
不,你必须提交()事务如果没有错误,否则回滚。 – 2013-03-15 07:50:50
当你尝试时会发生什么? – 2013-03-15 07:54:02
@Sudhanshu:不是根据JDBC JavaDocs(请参阅我的答案)。 – 2013-03-15 08:16:29