可以說我的代碼大致類似於這樣的東西:(使用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