File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes dirty read problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "dirty read problem" Watch "dirty read problem" New topic
Author

dirty read problem

raj esh
Greenhorn

Joined: Apr 03, 2010
Posts: 10
i have a jdbc code, which is fetching data from a table consists of lakhs of records and we are manipulating some values in table and these are posting into some other database(sap) and updating the record in our database as it is posted. but the problem is if we are running application from different servers(by mistake) the same reocrd is fetched in both applications, and manipulating and posting into sap database(this time posting twice)
i guess we have to set record level locking for this.how to set record level locking ?
can someone help me in this?
John Bengler
Ranch Hand

Joined: Feb 12, 2009
Posts: 132
Hi Banthi,

I'm not sure if this works for every database, but in Oracle you can use a "select for update", like described here:

Row Level Locking in JDBC

Just be sure to release your locks by commit/rollback when you're done..



John
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: dirty read problem
 
Similar Threads
Mark Spritzler/ Max H/Andrew Monkhouse: please comment on the holes in my design
lock and unlock idea, need critics!
JPA optional uniqueness check possible?
Locking Suggestions and Help
Multi-threading programming: we do not need lock() unlock() at all