when I print the isolation level
DatabaseMetaData dbMetaData = conn.getMetaData();
if (dbMetaData .supportsTransactionIsolationLevel(Connection.TRANSACTION_SERIALIZABLE)) {
System.out.println("Transaction Isolation level= "
+ conn.getTransactionIsolation());
System.out.println(dbMetaData.getDefaultTransactionIsolation());
}
for the connection I get an integer value 4
and for the database I get a value 2
I want to set the isolation level as SERIALIZABLE as it seems to work for most of the problems(that’s what i heard anyways :-/) but i am not getting as to how to set it as its asking for a int value
conn.setTransactionIsolation(level);
what does the integer levels refer to and in which order to the transaction levels? I am using mysql database
The
Connectionclass should have all the isolation levels defined as constants. Go to the Javadoc and you can see the constants.NOTE: TRANSACTION_SERIALIZABLE might not be the one what you want. I suggest you read this tutorial.
print readable string