aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Data integrity in database 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 "Data integrity in database" Watch "Data integrity in database" New topic
Author

Data integrity in database

Jonathan Elkharrat
Ranch Hand

Joined: Dec 31, 2008
Posts: 170

according to SUN assignment standalone mode must not use networking
so (as i understand) a client will access the server through the RMI but the
standalone mode would start an instance of the server and access through
it to the database. since they are 2 different server, there is a possibillity of
concurrent accessing the database. (clients and standalone)

am i right?


SCJP 5, SCWCD 5, SCBCD 5
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5266
    
  13

According to the instructions there will be at most 1 application accessing the database file at any time, so that would be the standalone application or the network server, but never both at the same time


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
mohammad abdellatif
Greenhorn

Joined: Aug 29, 2007
Posts: 24
Hi,
Allow me to participate in this conversation, what Roel De Nijs said:
According to the instructions there will be at most 1 application accessing the database file at any time, so that would be the standalone application or the network server, but never both at the same time


you can achieve this by using FileChannel.tryLock(), it helps in giving the JVM the exclusive lock over the file so now other process can lock it.

I hope you find it helpful.

Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5266
    
  13

instructions.html wrote:You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server.

The instructions clearly indicate that you don't need a lock over the file. So there is no need to add extra complexity to your program, because it will be unused. So your application has extra code, which have to be maintained, but will never be used.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Data integrity in database