Description: This section discusses topics pertinent to multi-user systems, in which concurrency is important.
Keywords: Transaction isolation levels, Isolation levels, Locking, Concurrency

# Locking, concurrency, and isolation

This section discusses topics pertinent to multi-user systems, in which concurrency is important.

Derby is configured by default to work well for multi-user systems. For single-user systems, you might want to tune your system so that it uses fewer resources; see Lock granularity.

- Isolation levels and concurrency
  Derby provides four transaction isolation levels. Setting the transaction isolation level for a connection allows a user to specify how severely the user's transaction should be isolated from other transactions.
- Configuring isolation levels
  If a connection does not specify its isolation level, it inherits the default isolation level for the Derby system. The default value is CS.
- Lock granularity
  Derby can be configured for table-level locking. With table-level locking, when a transaction locks data in order to prevent any transaction anomalies, it always locks the entire table, not just those rows being accessed.
- Types and scope of locks in Derby systems
  There are several types of locks available in Derby systems, including exclusive, shared, and update locks.
- Deadlocks
  In a database, a deadlock is a situation in which two or more transactions are waiting for one another to give up locks.

Parent topic: Controlling Derby application behavior
Related concepts
The JDBC Connection and Transaction Model
Result set and cursor mechanisms
Working with multiple connections to a single database
Working with multiple threads sharing a single connection
Working with database threads in an embedded environment
Working with Derby SQLExceptions in an application
Multi-user database access