Description: There are several types of locks available in Derby systems, including exclusive, shared, and update locks.
Keywords: Locks, exclusive, shared, update

# Types and scope of locks in Derby systems

There are several types of locks available in Derby systems, including exclusive, shared, and update locks.

- Exclusive locks
  When a statement modifies data, its transaction holds an exclusive lock on data that prevents other transactions from accessing the data.
- Shared locks
  When a statement reads data without making any modifications, its transaction obtains a shared lock on the data.
- Update locks
  When a user-defined update cursor (created with the FOR UPDATE clause or by using concurrency mode ResultSet.CONCUR_UPDATABLE) reads data, its transaction obtains an update lock on the data.
- Lock compatibility
  This table lists compatibility between lock types. + means the lock types are compatible, while - means they are incompatible.
- Scope of locks
  The amount of data locked by a statement can vary.
- Notes on locking
  In addition to the locks already described, foreign key lookups require briefly held shared locks on the referenced table (row or table, depending on the configuration).

Parent topic: Locking, concurrency, and isolation
Related concepts
Isolation levels and concurrency
Configuring isolation levels
Lock granularity
Deadlocks