Commit and Roll Back

When you have made changes to database information using the Data Access classes, the changes are not permanent in the database until you commit them. Use the following command to set a database to automatically commit changes:

theDeptDatastore.enableAutoCommit();

However, since you may wish to verify changes before committing them to the database, you will probably want to pass false in to this method. Note: the autoCommit setting is on (true) by default.

When autoCommit is turned off, you must manually commit your changes using the commit method, as follows:

theDeptDatastore.commit();

This command will commit the current unit of work (all changes made since the last time you committed).

If you make changes and decide that you do not want to commit them to the database, use the rollback method to undo the current unit of work:

theDeptDatastore.rollback();

The rollback method is effective only if the autoCommit setting is turned off. You can enable or disable autoCommit at any point in your application.



Connect and Disconnect


Connection Considerations
Data Access Class Library and Generated Code Reference