JDBC Isolation Level

Name the method that gives the existing isolation level in JDBC.

Questions by timmireddy   answers by timmireddy

Showing Answers 1 - 6 of 6 Answers

awasie

  • Nov 13th, 2009
 

Isolation level represent how a database maintains data integrity against the problems like dirty reads, phantom reads and non-repeatable reads which can occur due to concurrent transactions. java.sql.Connection interface provides methods and constants

You can get the existing isolation level with getTransactionIsolation() method and set the isolation level with setTransactionIsolation(int isolationlevelconstant).


that is for :

TRANSACTION_NONE = 0
TRANSACTION_READ_COMMITTED = 2
TRANSACTION_READ_UNCOMMITTED = 1
TRANSACTION_REPEATABLE_READ = 4
TRANSACTION_SERIALIZABLE = 8

Just to add more info to the above answer (public int getTransactionIsolation() throws SQLException from Connection interface) that their is always a trade-off between isolation level and concurrency & hence we should not keep the isolation level too low because that would make to too close to serialize beheaver and loosing out on the benefits of concurrency.

Thanks,
Vinay

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions