This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes DataBase Locking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "DataBase Locking" Watch "DataBase Locking" New topic

DataBase Locking

Ramesh kumaar
Ranch Hand

Joined: Mar 19, 2002
Posts: 146
Hello All,
How to do database locking. What does it mean how to achive it.
Ramesh kumaar
Ranch Hand

Joined: Mar 19, 2002
Posts: 146
Is there any one to help me.
Chiji Nwankwo
Ranch Hand

Joined: Jun 21, 2002
Posts: 56
When your application is running in remote mode it has the potential to be accessed by more than 1 client, when this happens you would need to deal with concurrency issues. You will need a mechanism that controls access to sensitive data, the db.db file in this case. One of the ways in which this can be achieved is by using the wait and notify(All) methods declared in the Object class. The use of these methods needs to be accompanied by the use of the 'synchronized' keyword. We have been provided with empty lock and unlock methods, where you decide to put these methods and how you decide to implement them is a choice that you will have to make.
Some people have implemented these methods in the Data class and some have implemented them in a LockManager. I'm sure that there are other ways and places that they can be implemented, but these seem to be the most common ones.
I hope this helps you.

SCJP, SCJD, SCWCD<br />"Meekness is not weakness, but power under control"
I agree. Here's the link:
subject: DataBase Locking
It's not a secret anymore!