Google News
logo
JDBC - Interview Questions
What are the isolation levels of connections in JDBC?
The transaction isolation level is a value that determines the level at which inconsistent data is allowed in a transaction, that is, the degree of isolation of one transaction from another. A higher level of isolation improves data accuracy, but it may decrease the number of concurrent transactions. On the other hand, a lower level of isolation allows for more concurrent transactions, but reduces the accuracy of the data.
 
When we use transactions in JDBC to ensure data integrity, the DBMS uses locks to block the access of other accesses to the data involved in the transaction. Such locks are necessary to prevent dirty reading (Dirty Read), non-repeatable reading (Non-Repeatable Read) and phantom reading (Phantom-Read).
 
The isolation level of the JDBC transaction used by the DBMS for the locking mechanism can be set using the setTransactionIsolation () method . You can get information about the level of isolation used by the Connection getTransactionIsolation () method.
Advertisement