File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Database Connections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Database Connections" Watch "Database Connections" New topic

Database Connections

Jay Damon
Ranch Hand

Joined: Jul 31, 2001
Posts: 282
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

Joined: Apr 14, 2004
Posts: 10336

It depends on which RDBMS you are using and what the default transaction isolation level is.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
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.
I agree. Here's the link:
subject: Database Connections
It's not a secret anymore!