permaculture playing cards*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes should we open the db.db at Server startup? 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 "should we open the db.db at Server startup?" Watch "should we open the db.db at Server startup?" New topic
Author

should we open the db.db at Server startup?

ludo Lacor
Greenhorn

Joined: May 16, 2001
Posts: 3
Hi there,
When I start my RMI-Server, I call the constructor: Data("db.db").
This means that the user doesn't need to specify the name of the database.
In local mode the user is able to specify the name (and location) though.
I was wondering whether this is a good approach or not.
ie: must the user be able to sprecify the database name when in remote mode, or should the server decide which database to select?
I Hope someone can help me with this...
Greetings Ludo
Aleksey Matiychenko
Ranch Hand

Joined: Apr 03, 2001
Posts: 178
IMHO:
The server should decide. The user should only know the name of the server.
ludo Lacor
Greenhorn

Joined: May 16, 2001
Posts: 3
thanks,
That was wat I thought too.
The problem is that in my assingment the following is written:
...
In either case, the program must allow the user to specify the location of the database
...
so i'm confused
Ludo
Marcus Beale
Ranch Hand

Joined: Apr 13, 2004
Posts: 33
Ludo,

I'm also confussed on this issue. My specification states:

"In either case, the program must alow 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."

This statement is located in the SERVER NETWORK APPROACHES section, but it sounds like they are talking about the client. It doesn't make any sense for the Server Network code to have any local database options at all.

If they are talking about the server:

Currently my database assumes that the database file is named "db-2x3.db" and that it's located in the current working directory. This does not satisfy the requirement. I don't have any GUI for my server and there is a requirement that all configurations must be done from a GUI - so I can't configure the location of the server's database file without making a GUI just for that purpose.
In a real server application the location of the database file (among otherthings) would be done through a configuration file passed in on the command line. This would allow you to run muliple instances of the server from one binary installation. This is forbidden, however, due to the explicit command line instructions.
I could make a goofy server GUI, but I'd like to avoid the extra work if possible.

If they are NOT talking about the server, but the client:

Then I would interpret the "database location" to be the hostname and port of the server. And it makes since to have a local database indicator. And to be on the safe side I'll let the user specify the location of the local database file.

So are they talking about the server or the client?
Javini Javono
Ranch Hand

Joined: Dec 03, 2003
Posts: 286
Hi,

The ambiguity probably arised from the word "The Program", which, in reality,
started like this:
java -jar runme.jar

can really be two programs: the client and the server, depending on the arguments
placed on the command line to start the application.

So, both my applications, the client app and the server app allow the user to specify
where on the hard-drive the database is; and, the client app, of course, can also
be told to use a URL for network access instead.

Thanks,
Javini Javono
Pavel Tcheshmedjiev
Greenhorn

Joined: Mar 09, 2004
Posts: 13
Your choice of RMI or serialized objects will not affect your grade, but no other approach is acceptable. In either case, 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

So database location should be spesified no matter RMI or serialized objects are used. It should also be specified if the application is in standalone mode.
If in network client mode, the url must be specified - the server has already been started with the appropriate DB location.

Greetings


SCJP, SCJD
Marcus Beale
Ranch Hand

Joined: Apr 13, 2004
Posts: 33
Pavel,

Yes the database server has already been started. But how did it get started? Are we required to let the user specify the location of the database file to serve up?

I'm going to err on the side of caution. I'm going to make a GUI for the server and allow the user to select the database file to serve up and the port to run RMI. And give them two buttons to start and stop the server.

,Marcus
Pavel Tcheshmedjiev
Greenhorn

Joined: Mar 09, 2004
Posts: 13
Hi Marcus,
Yes, that is exactly what you need to do.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11525
    
100

Hi Ludo,


The problem is that in my assingment the following is written:
...
In either case, the program must allow the user to specify the location of the database
...

so i'm confused


"Specify the location" is a nice generic term for what the client is doing. Both of the following statements "specify the location":
  • The database is at c:\data\db.db
  • The database is on the server at 192.168.1.1


  • Does that help you see how to meet this requirement?

    (Having said that, I like the idea of allowing the server application specify the path to the database as well, but you might decide that this is beyond requirements .

    Regards, Andrew


    The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: should we open the db.db at Server startup?