File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Locking - clarification needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Locking - clarification needed" Watch "Locking - clarification needed" New topic
Author

Locking - clarification needed

Miles McKernan
Greenhorn

Joined: Aug 16, 2004
Posts: 2
Hello ranch,

I started the developer exam a week ago. I need to start thinking about the locking requirements but the following line in the spec is confusing me:
(LOCKING)You may assume that at any moment, at most one program is accessing the database file

What I understand it that if only one program can access the file at the time, why the hell do I need to use all these locks on specific records for the data operations, when according to this spec I could synchronize on the whole file and there's no need to lock an individual record?
Am I missing the point here or are Sun just trying to confuse me with their poor DBAccess interface?

thanks a lot

Miles
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
Miles,
You may assume that at any moment, at most one program is accessing the database file

This is not the same thing as one user. It means that anyone want to access the db file has to go through your code. In real life, companies could have a database about thier clients. And, there could be many different software operating on this data. This is not the case in this project. You can assume that there is no other software accessing your db file.
In this case, there is still possibility that there will be multiple users trying to access the db file at the same time. Here, the synchronization will come to work.


SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Miles McKernan
Greenhorn

Joined: Aug 16, 2004
Posts: 2
Originally posted by Hanna Habashy:
Miles,

This is not the same thing as one user. It means that anyone want to access the db file has to go through your code. In real life, companies could have a database about thier clients. And, there could be many different software operating on this data. This is not the case in this project. You can assume that there is no other software accessing your db file.
In this case, there is still possibility that there will be multiple users trying to access the db file at the same time. Here, the synchronization will come to work.



Hannah, thanks a lot for this clarification, I can make sense out of it now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Locking - clarification needed