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 For update and Lock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "For update and Lock" Watch "For update and Lock" New topic
Author

For update and Lock

vicky Aggarwal
Ranch Hand

Joined: May 15, 2009
Posts: 40
Hi,

I have to perform some action in a table which shall be synchronized with multiple instances.

I created two tables first Lock and second which contains actual data. Now each instance first tries to acquire lock on Lock table by using
Select X from Lock for update.

My application is running fine, but I have a threat that if application which have lock goes down due to any error.

Will my application work or will it stuck?
If yes how to solve it and if not then how lock will be release and how such locks work?

Thanks in Advance.


Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

Schedule a background process that constantly checks the Lock table for those that have been held for more than a hour and release them. I believe, this should solve your issue.

S.D. MADHAN
Not many get the right opportunity !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: For update and Lock