有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java jdbc executeUpdate在自动提交模式下失败

在postgresql数据库的自动提交模式下,若jdbc executeUpdate抛出SQLException,则表示数据库中的数据未被修改?或者我应该将自动提交设置为false并手动管理它


共 (1) 个答案

  1. # 1 楼答案

    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/