• Post Reply Bookmark Topic Watch Topic
  • New Topic

Data integrity in database  RSS feed

 
Ranch Hand
Posts: 170
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!