假设我有以下 Java 代码片段(类似的东西嵌入到旧版应用程序中)
...
try {
con.setAutoCommit(false);
updateSales = con.prepareStatement(updateString);
updateTotal = con.prepareStatement(updateStatement);
updateSales.setInt(1, e.getValue().intValue());
updateSales.setString(2, e.getKey());
updateSales.executeUpdate();
updateTotal.setInt(1, e.getValue().intValue());
updateTotal.setString(2, e.getKey());
updateTotal.executeUpdate();
con.commit();
} catch (SQLException e ) {
...
假设这是连接到 SQL Server 2005 数据库(使用 ms 2005 驱动程序) - 是否有任何理由 con.commit 不会提交事务?