Committing Changes to the Database

Each time a change is made to a data row during editing, the database is updated. Locks are applied to the page containing the modified row. This causes that row and any other row on that page to be locked.

The COMMIT command or the SAVE command is used to commit all outstanding changes to the database.

The ROLLBACK command is used to remove changes since the last commit point. Any outstanding locks are released when the data is committed or a ROLLBACK is requested.

When a single user uses the database, the locks do not present a problem. When several users use the database, locking must be considered, even when the users are modifying different tables. Other users cannot access any rows on a page locked by another user.

Multi-User Considerations

In a multi-user environment, it is essential that consideration be given to the number of rows locked and the length of time those rows are locked. To minimize contention, use the command AUTOCOMMIT ON to specify that the changes are automatically committed every time ENTER or any function key is pressed.

This does, however, affect the impact of a ROLLBACK request. ROLLBACK restores the database to the last commit point. If the data is committed each time ENTER is pressed, the last commit point is the state of the data after the last ENTER.

Simply viewing the data does not automatically cause the rows to be locked. Read-only functions that fetch data, such as scrolling, do not modify the data. Locks are only applied when the data is actually changed.

Concurrent Updates

A concurrent update occurs when another user makes a change to the row between the time it is fetched and the update is requested. Access provides error recovery processing for this situation. For more information about the recovery processing, see Error Recovery for Concurrent Updates.