This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database Connections

 
Jay Damon
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't had an opportunity to run a test yet but I am hoping someone can answer a quick question which is this:

If I have a database Connection object, setAutoCommit to false, execute 1 or more UPDATE statements, then execute a SELECT before invoking commit, will the SELECT return the database table values prior to the UPDATEs or will it return the updated table values?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on which RDBMS you are using and what the default transaction isolation level is.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If using same connection object for retriving as well, most probably records after updation would come up.

But yes as paul said depends upon isolation level. If level is set to READ COMMITTED then it wouldn't read uncommitted records.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic