• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Client and server setup - database location

 
K. Tsang
Bartender
Posts: 3510
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all, I have a question about choosing database location. Suppose when starting the server mode or local mode, the user enters a file that isn't the correct file (such as wrong magic cookie value, or simply blank file). Now my current approach is once they enter this value, I save it in a Properties and store into the properties file then load the main window. If wrong file, it pops up an error saying can't find or read file and exit.

Now since the file path already stored in the properties file, subsequent runs will always pop up error. Will this cause me automatically failure?? Since the properties file is generated on the fly and Sun examiners are supposed NOT to change any files. Is the properties file part of this "NOT change" business?
 
Mahesh Kumaraguru
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each time the application is started in either Server or Standalone mode, can the user change the location of database file?

One option is that you save the file location to the properties file only if the file is correct ie the file exists on disk and magic cookie is correct. This way, user would always see the last correct file
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, K!

This was my approach: before anything, I get the database path the user provided, and verify if it exists (new File(dbLocation).exists()). If so, then I proceed and save this path in the .properties file, if not, I show a JOptionPane.showMessageDialog, saying that the path is invalid.
 
K. Tsang
Bartender
Posts: 3510
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK then I guess I need to change my approach a bit. Thanks all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic