This table summarizes the locking behavior for each type of lock that Microsoft Jet uses.
Lock name |
What sets the lock | What is locked | What the lock prevents | Persistence of the lock | Shared or exclusive | Byte range examples |
User | User opens a database | N/A | Nothing | Until user closes the database | N/A | 10000001 10000001 |
Write | Insert, update, or delete | All available pages | Updates or deletes to data and sometimes inserts to a table | Controlled by locking mode set by user or the duration of a transaction | Exclusive | 2000A601 2000A701 |
Read (version 2.x) |
Reads on long value or index pages |
Long value, index, or table header pages | Updates or deletes to long value or index pages |
Controlled by LockedPage- Timeout setting or the Idle method of the DBEngine object with the dbFreeLocks constant |
Shared | 30001E01 30001E01 |
Read (versions 3.0 and 3.5) |
Reads on certain long value or index pages when referential integrity is being enforced | Long value, index, or directory pages | Updates or deletes to long value or index pages | Until a read or a transaction is complete or the user moves to a new record | Shared | 20063801 20063801 |
Commit (version 2.x only) |
Writes to long value or index pages |
Long value or index pages | Prevents reads when data is being written to disk | Held until data is written to disk | Exclusive | 30001A01 30001B01 |
Lock name |
What sets the lock | What is locked | What the lock prevents | Persistence of the lock | Shared or exclusive | Byte range examples |
Table-read | Shared lock is obtained when table is opened. Exclusive lock is obtained when Default Record Locking in Microsoft Access is set to All Records or a recordset is opened through DAO using the dbDenyRead constant for the options argument of the OpenRecordset method. | Table header page | Prevents exclusive read lock from being set | As long as the table is kept open by the user | Both | 4000C801 4000C801 |
Table-write | Shared lock is obtained when table is opened. Exclusive lock is obtained when Default Record Locking in Microsoft Access is set to All Records or a recordset is opened through DAO using the dbDenyRead constant for the options argument of the OpenRecordset method. | Table header page | Prevents exclusive write lock from being set; doesnt prevent table deny-write lock | As long as the table is kept open by the user | Both | 5000C801 5000C801 |
Table deny-write | Can be set only through DAO | Table header page | Prevents all writes to the table | As long as the table is kept open by the user | Both | 6000C801 6000C801 |