10.4 Commits and Rollbacks 

Previous Index Next 


A database commit, makes any changes that have been made to a database, since the last commit, permanent. A set of changes can be undone by doing a database rollback instead of a commit.

In the JDBC the default behavior is set to auto-commit. This means that as each SQL command is executed it is automatically committed. Auto-commit can be turned off by calling the setAutoCommit() method on the Connection object.

Once the auto-commit mode commit mode has been turned off the commit() and rollback() methods on the Connection object can be used to commit or rollback changes to the database.