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 How can i explicitly lock a row of a Table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How can i explicitly lock a row of a Table" Watch "How can i explicitly lock a row of a Table" New topic
Author

How can i explicitly lock a row of a Table

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi

How can we implement optimistic locking , i am using Oracle as Database for my Application .

Assume that i am working on a single row of a Table .

Now please tell me how can i explicitly lock this row , so that other simultanoues users insert or update operations are not affected to this particular row .

I am not using any ORM related technology

Please help .



Save India From Corruption - Anna Hazare.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Row locking is not optimisitc locking, its pessimistic locking. You do this by using the select...for update syntax in Oracle.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

You do this by using the select...for update syntax in Oracle.



can you please elobrate this answer .
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Select for update selects a set of data locking it from updates by other transactions (i.e. pessimistic locking). Other than that there is not much extra I can really say. Have a look at the Oracle documentation for select, it has a more complete answer than I am likely to give here.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can i explicitly lock a row of a Table