This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

should we open the db.db at Server startup?

 
ludo Lacor
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMHO:
The server should decide. The user should only know the name of the server.
 
ludo Lacor
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Marcus Beale
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marcus,
Yes, that is exactly what you need to do.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11854
185
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic