cjack
cjack

Reputation: 77

How to Change the Transaction Isolation Level

 DatabaseMetaData metaData = con.getMetaData();
         System.out.println("ISOLATION LEVEL OF MYSQL DB BY DEFAULT IS: "+metaData.getDefaultTransactionIsolation());//here 2

After changing the isolation level in the Java application will it affect in the database aswell?

 //in oracle
 con.setAutoCommit(false);
 con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);//4
 con.commit();
 System.out.println("after changing the isolation level ,current isolation level is: "+con.setTransactionIsolation()); //here 4

My question is it will it affect the database setting of isolation levels? What is the isolation level after this code executes?

Upvotes: 0

Views: 107

Answers (1)

rogue-one
rogue-one

Reputation: 11577

The Transactions Isolation level is specific to your session. Hence only the your current session property would change.

Upvotes: 2

Related Questions