wood burning stoves*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes client and database URLyBird 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 "client and database URLyBird" Watch "client and database URLyBird" New topic
Author

client and database URLyBird

Robert Aragon
Greenhorn

Joined: Jul 11, 2005
Posts: 18
Server has to read and update the databasefile.db Client in this case must make a network connection to the server. In this case the databasefile.db sits on the server machine.

Client must also be able to do it but without a network connection.

Where is this databasefile.db supposed to sit? On the server machine or on the client machine?

Maybe I am to assume that the server AND the client are both on the same machine. Thus, the databasefile.db is on that machine too?

Client cannot locally connect to the databasefile.db is that file is on another machine.


SCJP
Mike Grandmaison
Greenhorn

Joined: Apr 14, 2004
Posts: 12
The jar that you end up shipping contains both client and server code. Then depending on what mode the jar is run in it will look for the database file. So in the case of client and server on two physically seperate machines the client is run in client mode and does not look for the file, the server is run in server mode and looks for the file. In the case of standalone mode the client is on the same physical machine as the database file and it finds it.
Robert Aragon
Greenhorn

Joined: Jul 11, 2005
Posts: 18
Machine A contains the database.
Machine A contains the client.
Machine B contains the server.

When run in server mode, not local mode by the client, the server has to
make a network connection to Machine A. Right?

When run in client mode, locally where the client makes NO network connection
to the server, the client connects to the database on the same machine it is
on. Right?

It just seemed strange that the client has to make a network connection to the server, but then the server makes a connection to the machine the client is on because the database is on that same machine. Right?
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11464
    
  94

Hi Robert,

I think you are trying to cater for a non-existant problem. Consider the following scenario
  • Machine A has database
  • Machine A has runme.jar
  • Machine B has runme.jar


  • Machine B does not have direct access to the database (that is, there are no drive mappings (for Microsoft) or remote network mounts (for Unix and unix like systems).

    In that situation, we could have:
  • Machine A running java -jar runme.jar alone (to run as a standalone client


  • Or:
  • Machine A running java -jar runme.jar server in one JVM (to run as a server). In this case we have two other options:
  • Machine A running java -jar runme.jar in another JVM running as a networked client connecting to the server on Machine A
  • Machine B running java -jar runme.jar running as a networked client connecting to the server on Machine A

  • However we cannot have Machine B running java -jar runme.jar server since the database is not local. Trying to get this scenario to work is (in my opinion) beyond the scope of the assignment.

    Regards, Andrew
    [ July 27, 2005: Message edited by: Andrew Monkhouse ]

    The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
    Robert Aragon
    Greenhorn

    Joined: Jul 11, 2005
    Posts: 18
    O.K. So for the sake of this assignment, everything can be put on the same machine?

    I guess everyone who has turned in their assignment and passed, has done so so that it works on ONE machine. server, client, and database are all on the same machine, right? Whew.

    These three commands are ALL on the same machine, right?

    java -jar file.jar server
    java -jar file.jar

    java -jar file.jar alone
    Frans Janssen
    Ranch Hand

    Joined: Dec 29, 2004
    Posts: 357
    Originally posted by Robert Aragon:
    I guess everyone who has turned in their assignment and passed, has done so so that it works on ONE machine. server, client, and database are all on the same machine, right? Whew.

    Hi Robert,

    It should work on one machine and of course during my development that is how I tested it.
    However, it must also work when client and server are on different machines and it is very important that you test that that works, because if it doesn't work, you will probably fail the assignment.

    Frans.


    SCJP 1.4, SCJD
     
    GeeCON Prague 2014
     
    subject: client and database URLyBird