void setAutoCommit(boolean autoCommit) throws SQLException
Sets this connection's auto-commit mode to the given state. If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by a call to either the method commit or the method rollback. By default, new connections are in auto-commit mode.
The commit occurs when the statement completes. The time when the statement completes depends on the type of SQL Statement:
- For DML statements, such as Insert, Update or Delete, and DDL statements, the statement is complete as soon as it has finished executing.
- For SELECT statements, the statement is complete when the associated result set is closed.
CallableStatementobjects or for statements that return multiple results, the statement is complete when all of the associated result sets have been closed, and all update counts and output parameters have been retrieved.
NOTE: If this method is called during a transaction and the auto-commit mode is changed, the transaction is committed. If
setAutoCommit is called and the auto-commit mode is not changed, the call is a no-op.
true to enable auto-commit mode; false to disable it
SQLException - if a database access error occurs
For more information, reference JDBC documentation for: Connection.setAutoCommit(boolean)