• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Locking - clarification needed

 
Miles McKernan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Miles McKernan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic