Define Isolation.

Define Isolation.

- Isolation ensures one transaction does not interfere with another.

- Isolation helps when there are concurrent transactions.

- In order to set the isolation level for a JDBC transaction, we can use Connection.setTransaction(int level) method.

- There are five levels of transaction isolation which are as follows:

1. JDBC_TRANSACTION_NONE:
- A special constant that JDBC driver does not support transactions.

2. JDBC_TRANSACTION_READ_UNCOMMITTED:
- Allows looking after the uncommitted changes to the database.

3. JDBC_TRANSACTION_READ_COMMITTED:
- The transactions are externally invisible until the transaction is committed.
- The dirty reads prevention is possible with this level.

4. JDBC_TRANSACTION_REPEATABLE_READ:
- The readable rows retain locks by which another transaction can not change them until the transaction completes.
- It disallows dirty reads and non repeatable reads.

5. JDBC_TRANSACTION_SERIALIZABLE:
- The tables are locked for the transaction which makes the WHERE conditions not to be changed by other transactions.
- This process prevents all database anomalies.
What are the Transaction levels available?
What are the Transaction levels available? - TRANSACTION_NONE, TRANSACTION_READ_UNCOMMITED, TRANSACTION_READ_COMMITTED....
What is the purpose of setAutoCommit do?
What is the purpose of setAutoCommit do? - A connection is in auto-commit mode by default which means every SQL statement is treated as a transaction....
What is JDBC driver?
What is JDBC driver? - The JDBC Driver provided by the JDBC API, is a vendor-specific implementations of the abstract classes....
Post your comment