javaguy
javaguy

Reputation: 4432

Isolation level in database

I understand isolation level concept. But how do you set it and where? I have never seen it in java programs to mess with this.

Upvotes: 0

Views: 211

Answers (2)

Jonathan Leffler
Jonathan Leffler

Reputation: 754080

There will be a default isolation level, determined by the combination of the Java software used to access the DBMS and the DBMS itself. Generally, it is likely to work at a high level of isolation (SERIALIZABLE in the SQL Standard), but you can change the level at which you work using methods such as the one identified by stacker.

There may also be DBMS-specific statements you can use. The SQL Standard provides SET TRANSACTION as a preparable statement; you may find you have a statement such as SET ISOLATION too.

Upvotes: 2

stacker
stacker

Reputation: 68962

See the Connection interface. It defines the constants TRANSACTION_XXX which can be used with the setTransactionIsolation() method.

Upvotes: 4

Related Questions