GeeCON Prague 2014*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Server database file 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 "Server database file location" Watch "Server database file location" New topic
Author

Server database file location

Maximilian Heva
Greenhorn

Joined: Jan 26, 2007
Posts: 4
When running the application in server mode, where should the server locate it's database file? The database-file provided together with runme.jar? Or a another database file merged in inside the runme.jar?

If the answer is yes to one of this questions, what's the best way of locating this file assuming that the java command is executed in another directory than the runme.jar?

I don't have (and do not wan't) any GUI or properties configuration whatsoever running in server mode.

Thanks!
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
Originally posted by Maximilian Heva:
I don't have (and do not wan't) any GUI or properties configuration whatsoever running in server mode.

Thanks!


Its a requirement to allow the user to specify the database location in a configuration GUI and then to store this value in a properties file.

Mark.


SCJP<br />SCJD
Maximilian Heva
Greenhorn

Joined: Jan 26, 2007
Posts: 4
I've understood the requirement of the user selecting the database file only applies when running the client in standalone mode...
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288

All configuration must be done via a GUI, and must be persistent between runs of the program. Such configuration information must be stored in a file called suncertify.properties which must be located in the current working directory.



the program must allow the user to specify the location of the database, and it must also accept an indication that a local database is to be used, in which case, the networking must be bypassed entirely. No authentication is required for database access.


I can't see anything in either of these two statements that suggests that the user should only specify the location of the database file in local mode. The only mention of local mode is that no network code should be used to access a local database.

It also makes sense that if you can specify a database in local mode then this also should be available in server mode. What about if you have to switch to a backup file because of a corrupted db for example?

Mark
Rudolph Jen
Ranch Hand

Joined: Nov 17, 2006
Posts: 37
Ah, you don't mean specified by path (like c:\temp\myDBFile.db)? You mean just the Database itself, e.g. myDBFile.db or my2ndDBFile.db. The path-location of the databases are define in a property?


SCJP<br />SCJD (in progress)
Maximilian Heva
Greenhorn

Joined: Jan 26, 2007
Posts: 4
I guess I'll need a GUI for the server with buttons for start and stop server and a filechooser for the database file (the path of the file) to run against.
I do not see any other way to do it....

The property file will contain path values for client standalone database file as well as server database file.

thanks
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
Originally posted by Maximilian Heva:
I guess I'll need a GUI for the server with buttons for start and stop server and a filechooser for the database file (the path of the file) to run against.
I do not see any other way to do it....

The property file will contain path values for client standalone database file as well as server database file.

thanks


You still needn't have a GUI, you can pop up a JDialog and take in the properties this way. Once this is done you can discard the dialog and have a command line server.

To do this you will need a JFrame reference to use as the parent window for the dialog. In my app class I have a window object that is a JFrame instance. In server mode it is my intialised as the serverGUI and in local and network mode it is intialised as the client GUI.

If you don't wish to have a serverGUI this reference can be null in server mode, however even a null JFrame object can still be used as the parent for a JDialog so you can have a server properties GUI and a then a command line server once the properties have been displayed.

Hope this helps,
Mark

Mark
Maximilian Heva
Greenhorn

Joined: Jan 26, 2007
Posts: 4
Thanks for your suggestions. Although I believe a pop-up is a kind of GUI...

Anyway, if someone has implemented a non GUI server, I would be happy to
receive any ideas how/where to locate the server database file....
 
GeeCON Prague 2014
 
subject: Server database file location