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

Client and server setup - database location

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2416
    
    7

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?

K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Mahesh Kumaraguru
Ranch Hand

Joined: Jun 01, 2005
Posts: 95
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


Regards,<br />K. Mahesh<br /> <br />SCJP 1.2 Aug-2001 : 79%
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

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.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2416
    
    7

OK then I guess I need to change my approach a bit. Thanks all.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Client and server setup - database location