wood burning stoves 2.0*
The moose likes JDBC and the fly likes does developer bother setting Isolation Levels Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "does developer bother setting Isolation Levels " Watch "does developer bother setting Isolation Levels " New topic
Author

does developer bother setting Isolation Levels

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,


If we are doing DDL , or DML OR select operation againist Oracle , does a developer bothers about setting Isolation Levels ??

I am asking this question , because in my projects till now , me nor my collegueous saw setting Isolation Levels in their JDBC code ??

So , please let me know if a develpor need to bother setting Isolation Levels when using JDBC ??

I am asking this question with respect to Oracle only not related to HSQLDB or any small databases .

??


Save India From Corruption - Anna Hazare.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30555
    
152

You are probably using the default. If the default meets your needs, you don't need to do anything.

Another reason you often don't see the isolation level set in the code is that it is configured at a higher level - Spring or EJB.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


If we are doing DDL

NB: DDL operations are not transactional.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Prabhakar Reddy Bokka
Ranch Hand

Joined: Jul 26, 2005
Posts: 189

Jeanne Boyarsky wrote:You are probably using the default. If the default meets your needs, you don't need to do anything.


what are the default isolation levels and where they are specified?


SCJP 5, SCWCD 5
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

Prabhakar Reddy Bokka wrote:what are the default isolation levels and where they are specified?

For isolation levels available to JDBC, see Oracle's JDBC Developer Guide (bottom of the page). Note that it may be very useful to read all of this book.

For description of these isolation levels in Oracle database, see Database Concepts Guide. Again, the complete guide is a very useful reading, even (or especially) if you are fluent in other databases. If you are on a different Oracle version, search for the documentation for your version.
Prabhakar Reddy Bokka
Ranch Hand

Joined: Jul 26, 2005
Posts: 189

OK.
Is this isolation level follow all databases by default or different isolation levels for different databases?
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

Default isolation level for Oracle is TRANSACTION_READ_COMMITTED. Of course, frameworks could change this, so if you use any framework, you should consult its documentation. The same applies to other databases/drivers/frameworks - you need to look this up in the doco.

There is definitely not a single default isolation level for all databases. Moreover identically named isolation levels may work differently in different systems, eg. read commited in Oracle will never produce inconsistent results, which may not be true for databases that do not employ multiversioning. You need to read quite a lot about the database of your choice to understand the implications of the isolation levels, among other things.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

NB: DDL operations are not transactional.

While most of DDL operations in Oracle are atomic, the caveat is that any DDL operation issues an implicit commit. This may prove very confusing, as your transaction commits without calling commit() in your code.

However, you should seldom need to do DLL in an Oracle database. If your DDL concerns temporary tables, you definitely need to read this (search for documentation for your DB version if it is different from this one). Temporary tables in Oracle are different beasts from most other database systems. Very useful information can be also found on the AskTom site - search for "temporary table".

Edited: I've written a misleading description of SERIALIZABLE isloation level here previously. Here is what the Oracle documentation says on isolation levels:

The ISOLATION_LEVEL parameter specifies how transactions containing database modifications are handled. ISOLATION_LEVEL is a session parameter only, not an initialization parameter.

SERIALIZABLE indicates that transactions in the session use the serializable transaction isolation mode as specified in SQL92. That is, if a serializable transaction attempts to execute a DML statement that updates rows currently being updated by another uncommitted transaction at the start of the serializable transaction, then the DML statement fails. A serializable transaction can see its own updates.

READ COMMITTED indicates that transactions in the session will use the default Oracle Database transaction behavior. That is, if the transaction contains DML that requires row locks held by another transaction, then the DML statement will wait until the row locks are released.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: does developer bother setting Isolation Levels