8.2.31 setAutoCommit(boolean autoCommit)
- Organization of this subsection
(1) Function
This method sets the automatic commit mode for this connection.
(2) Format
public synchronized void setAutoCommit(boolean autoCommit) throws SQLException
(3) Arguments
- boolean autoCommit
-
Specifies true to enable the automatic commit mode or false to disable it.
(4) Return value
None.
(5) Exceptions
If this Connection object is closed, the JDBC driver throws an SQLException.
(6) Notes
-
When the automatic commit mode is enabled, an SQL statement is committed automatically when its processing is completed. Therefore, each SQL statement is treated as one transaction. When the automatic commit mode is disabled, an SQL statement is not completed until the commit or rollback method is executed. By default, the automatic commit mode is enabled.
-
Automatic commit is performed upon completion of an SQL statement. If the SQL statement returns a ResultSet object, the SQL statement is completed when the ResultSet object is closed.
-
A transaction that is executing when this method is called will not be committed.