Description: When auto-commit is disabled, you use a Connection object's commit and rollback methods to commit or roll back a transaction.
Keywords: Auto-commit, and transactions

# Transactions when auto-commit is disabled

When auto-commit is disabled, you use a Connection object's `commit` and `rollback` methods to commit or roll back a transaction.

The `commit` method makes permanent the changes resulting from the transaction and releases locks. The `rollback` method undoes all the changes resulting from the transaction and releases locks. A transaction encompasses all the SQL statements executed against a single `Connection` object since the last `commit` or `rollback`.

You do not need to explicitly begin a transaction. You implicitly end one transaction and begin a new one after disabling auto-commit, changing the isolation level, or after calling `commit` or `rollback`.

Committing a transaction also closes all `ResultSet` objects excluding the `ResultSet` objects associated with cursors with holdability `true`. The default holdability of the cursors is `true` and `ResultSet` objects associated with them need to be closed explicitly. A commit will not close such `ResultSet` objects. It also releases any database locks currently held by the `Connection`, whether or not these objects were created in different threads.

Parent topic: Transactions
Related concepts
Using auto-commit
Explicitly closing Statements, ResultSets, and Connections
Statement versus transaction runtime rollback
Related tasks
Turning off auto-commit
Related reference
Holdable result sets