在 postgresql 数据库的自动提交模式下,如果 jdbc executeUpdate 抛出 SQLException 是否意味着数据库中没有数据被修改?或者我应该将 autocommit 设置为 false 并手动管理它?
最佳答案
When a connection is created, it is in autocommit mode. This means that each individual SQL statement is treated as a transaction and is automatically committed right after it is executed. This is true for all JDBC drivers, including the PostgreSQL's one. To start a new transaction, we turn the autocommit off.
要阅读更多内容和示例代码,请查看:http://zetcode.com/db/postgresqljavatutorial/
关于java - jdbc executeUpdate 在自动提交模式下失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17392689/