Connection.setAutoCommit
Interface Overview | Interface Members |
This Package |
All Packages
public abstract void setAutoCommit( boolean autoCommit ) throws SQLException
Parameters
- autoCommit
- true enables auto-commit; false disables
auto-commit.
Description
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 either commit() or
rollback(). By default, new connections are in auto-commit
mode.
The commit occurs when the statement completes or the next
execute occurs, whichever comes first. In the case of
statements returning a ResultSet, the statement completes when
the last row of the ResultSet has been retrieved or the
ResultSet has been closed. In advanced cases, a single
statement may return multiple results as well as output
parameter values. Here the commit occurs when all results and
output param values have been retrieved.
Exceptions
SQLException
if a database-access error occurs.