• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Database location

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ranchers,
In my instructions stays:
"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".
Does this mean that the user set the file in the directory before he starts the application and fills a text field with this path? I am not sure about this.
How will the user give the path: like C:\Java\Sun\db.db ? or only C:\Java\Sun? How have you do this?
I hope of a quickly answer.
Regards,
Maria
 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maria,

Originally posted by Maria Lepschy:
Hello ranchers,
In my instructions stays:
"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".
Does this mean that the user set the file in the directory before he starts the application and fills a text field with this path? I am not sure about this.
How will the user give the path: like C:\Java\Sun\db.db ? or only C:\Java\Sun? How have you do this?
I hope of a quickly answer.
Regards,
Maria


If you read the instructions completely, you can see the following:


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.


Because the application is supposed to run in three modes as specified, and depending on the mode we have to give the input.
If the application runs with "server" as argument its "server" mode, then you are supposed to provide the "db filepath" and "port" in a GUI and persist these two in a file as specified by Sun. In this mode, you have to configure the Server and start it.
If the application runs with "alone" as argument its "stand alone" mode, we have to provide the "local db filepath" in a GUI and then persist this info. In this mode all network server code is bypassed.
If the application starts with NO arguments, its a "Network Client" mode. We have to provide the "port" number and "host name" for the server. The client connects to the server remotely in this mode.
What they meant by "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" is when the application starts as above, we are allowing the user to specify the location of the database right? This is what they meant. One for "server" mode and location of local database for "alone" also called as "standalone" mode.
Hope this helps.
 
Maria Lepschy
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Satish.
But you have not answer my question directly- so I have not the answer of my question.
I don't think that in client mode the user has to specify the host and port.
This must be done in server mode. Why should be configured the port in server and port and host in client mode? Client mode means, the client will be run after the server was runing. Or I am wrong? My question was only what the setting of the db path means. The file should be copied from the working directory into the specified directory or the file was before the start of application set into the specified path?
Regards,
Maria
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maria, if I did'nt convince you first time. I will try to explain in detail now.

Originally posted by Maria Lepschy:
Thank you Satish.
But you have not answer my question directly- so I have not the answer of my question.
I don't think that in client mode the user has to specify the host and port.
This must be done in server mode. Why should be configured the port in server and port and host in client mode? Client mode means, the client will be run after the server was runing. Or I am wrong?

From the given requirements the appication MUST run in only three modes. These modes are the command line arguments that are specified when we start the application. The ONLY three modes(command line arguments) that are acceptable are "server", "alone" and left entirely(no arguments).
"server" mode:
In this mode, we are supposed to enter the "db filepath" and "port" number to start and configure the server. No business functions can be performed here. The only purpose of this is to configure and start the server using a GUI which takes the above said values.
"alone" mode:
Also called as "standalone mode". In this mode, we have to enter ONLY the "db filepath". That is it. There is no concept of server here. The network is completely bypassed.
left entirely mode:
This is called the "Network Client" mode. What this is means is the server is running on a different machine than that of client. So the client shoud be able to connect to the server and then perform the operations. So what we need to know in this mode is the location of server to connect i.e. the "host" name of the server and the "port" number where the server is listening. If we know these two values, we can connect to the server from a remote client.

My question was only what the setting of the db path means.

What I understand from "Setting of db path" is as you can see, in the above three modes, two modes("server" and "alone") require the location of db filepath.

The file should be copied from the working directory into the specified directory or the file was before the start of application set into the specified path?

We do not copy the file. All we do is before the start of the application, we specify where exactly the db is present. It might be in the current working directory or in a whole different place. We don't know. That is why we set the db file path at start of application. Because first the evaluator may want to test the application with the db present in the current working directory. Later the evaluator wants to test a file from a different directory. Everytime he wants to test, he don't need to copy the file to the current working directory. He can just enter the location at the start of the file, and we set it in properties file. Our Data class works on the db file specified like this.

Regards,
Maria


Hope this helps and Let me know if I'm not still clear.
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maria, I think Satish is right.
When start up the DB server, you do need to specify your DB file path on your system via a GUI. And you are right, DB file path is the location of the file on your file system. Just think, the file may be used (or still using) by a legacy system and your new program need to point to that. The user can give the path by clicking on the "Browse..." button, or a text field as you said, the choice is yours. Oh user means the person who starts the server. If any one diagree, please drop a few words.
If you need to understand more, I think this is a very good post
Hope this helps.
[ February 28, 2004: Message edited by: Anna Kafei ]
 
Maria Lepschy
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Satish, Anna,
Many thanks, now I understand. Of course the client don't know which port and host the server has. Then by start client it must be checked if the port is the same like the value from property file where the value from port was entered by start from server. I am rigth?
From which countries are you? I live in Germany, but I came from Romania.
 
Anna Hays
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you are almost right, except it doesn't really check if the host and port values entered by the client is checked against the properties file. If the values the client entered are wrong, then the client won't be able to connect.
When I say client here, I meant remote client that connects from a different JVM. Local client (from the same JVM) is a whole new story, it doesn't use host and port.
That's my understanding. Feel free to throw in 2 cent
Oh I am from down under
 
Maria Lepschy
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, Anna, nice that you have answer. I meant of course the network client.
Regards,
Maria
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic