e240. committing and rolling back updates to a database.txt
来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 15 行
TXT
15 行
By default, a connection commits all updates to the database immediately and automatically. For example, executing an UPDATE SQL query immediately commits the change. This example shows how to disable auto-commits and explicitly commit.
try {
// Disable auto commit
connection.setAutoCommit(false);
// Do SQL updates...
// Commit updates
connection.commit();
} catch (SQLException e) {
// Rollback update
connection.rollback();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?