• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC isolation level vs query

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using an EJB container (websphere) in which I use a JDBC datasource. The settings on the datasource let me define a JDBC transaction isolation level (serializable,repeatable read etc). I do understand the differences of these settings, but I do not understand the following:

Regardless of the isolation setting on the JDBC connection I can perform queries which include this information also. I'm using DB2 as database, so I can perform the following query:

"select * from table.name where id=1 for update with rr"

This query results in a row lock. Its impossible for another transaction to delete or modify row with id=1. So even if my transaction isolation was set to 'read uncommited' this query will prevent any modification to the row read.

So my questions are as followed:

- Is it true that the JDBC transaction isolation option is the same as the options I can specify within my SQL queries ? So they do basicly the same thing.

- Can I look at the JDBC transaction isolation option to work as a default for *all* the queries made by that connection ? So even queries that do not specify anything related to isolation, they will still be executed with the level specified for the JDBC connection

- May queries perform more fine grained and restrictive isolation. For example, I set the JDBC connection on 'read uncommited' which is just fine for 4 of the 5 tables. However, for dealing with table 5 I need serious locking, so only for the queries which operate on table 5 I specify more restrictive isolation in the queries.

I search a lot on the internet, but nowhere I can find a *real* explanation for my questions. Only pieces of the puzzle..any comment on this will be greatly appreciated !
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Guru Java",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Guru Java
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats my real name, I cant help it :-)
I'll change it
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic