• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to specify the Database file.

 
Rag Srinivasan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are some instructions taken from my assignment.
*** BEGIN ***
When you submit your assignment, each part (client and server) must be executable using a command of this exact form:
java -jar <path_and_filename> [<mode>]
Your programs must not require use of command line arguments other than the single mode flag, which must be supported. Your programs must not require use of command line property specifications. 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 mode flag must be either "server", indicating the server program must run, "alone", indicating standalone mode, or left out entirely, in which case the network client and gui must run.
*** END ***
How do I specify the actual db file itself (in my case the file is db-1x2.db) ? Is it hard coded in source code ? There is no ambiguity in the requirements where it says "must not require use of command line arguments other than the single mode flag". I see other threads on this subject, but the responses leave me more confused
It makes little sense (atleast to me) for clients to tell the server where the file containing data resides. The only config info that the client needs is "hostname" and "port".
thanks
-- Raghavan
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this thread Zhi's instructions say that you must allow the user to select the database location, which would mean that that same gui for the properties should have an area for them to specify the location of the database file. Now you can have a "browse" button next to it and use the JFileChooser class to allow them to select it.
Good Luck
Mark
 
Rag Srinivasan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Spritzler:
In this thread Zhi's instructions say that you must allow the user to select the database location, which would mean that that same gui for the properties should have an area for them to specify the location of the database file. Now you can have a "browse" button next to it and use the JFileChooser class to allow them to select it.
Good Luck
Mark

Sorry to belabour the point, but if the client specifies the name of the db file that the server is supposed to use then we could have the following complex scenario.
Several clients taking to the same server, but each telling the server to read data from a different file !! What I mean is, a server process running on a host and a specified port that has to support access to multiple database file. So a client has to consequently (in a stateless protocol between client and server) mention the name of the data file along with each request.
When the requirements say that the "program must allow the user to specify the location of the database", could it mean that the client should be able to specify the "host" and "port" not the actual file that the data resides in ?
thanks
-- raghavan
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I think host and port is probably what is meant by "location". You could allow them to specify file path too, but it complicates things, and requires them to ba able to browse the server's file structure, which is probably none of their business. Simpler to let the person who starts the client choose what server they connect to (host and port), and let the person who starts the server choose which file (path) they want to access.
 
Rag Srinivasan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jim Yingst:
Yes, I think host and port is probably what is meant by "location". You could allow them to specify file path too, but it complicates things, and requires them to ba able to browse the server's file structure, which is probably none of their business. Simpler to let the person who starts the client choose what server they connect to (host and port), and let the person who starts the server choose which file (path) they want to access.

Thanks a lot. That clarifies a lot.
regards
-- Raghavan
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In local mode they will have to specify the location of the db.db file, meaning the file on the directory. In remote mode the location would be the host and port.
Does that make sense?
Mark
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right, I was talking about server mode vs. client mode - forgot to mention standalone mode.
 
Rag Srinivasan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jim Yingst:
Right, I was talking about server mode vs. client mode - forgot to mention standalone mode.

Yes it makes sense !!
I am sorry Mark, I did not read your message till today since I saw light at the end of the tunnel after I saw Jim's earlier reply.
Thanks for your clarification both of you.
regards
-- Rag
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic