File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Database Selection Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Database Selection Question" Watch "Database Selection Question" New topic
Author

Database Selection Question

Ulises Pulido
Ranch Hand

Joined: Jul 24, 2008
Posts: 81
Hello All!

First of all Happy New Year!, second, I have a question I hope you can help me with, The thing is about the statement "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 can select the database in case that the db file is in the same computer as the GUI is running but it will only put the IP Address and port in case of a networking connection ?

I mean:
1) Select a database in the same machine and bypass the networking
2) Set an IP Address and a port to be used for networking (Not selecting where the database is in the server side).


Am I correct?


SCJP 5.0, SCWCD 5.0, SCBCD 5.0, SCJD, SCEA in progress
www.ulisespulido.com
christian combarel
Ranch Hand

Joined: Aug 04, 2007
Posts: 47
Hi,
1) Select a database in the same machine and bypass the networking
2) Set an IP Address and a port to be used for networking (Not selecting where the database is in the server side).


You're right !

... it must also accept an indication that a local database is to be used

Just indicate in your connection GUI that the database is a local one (in my opinion)


-------------
Chris
Ulises Pulido
Ranch Hand

Joined: Jul 24, 2008
Posts: 81
I have another question regarding this issue.

I believe that using a property file where the database path can be stored is enough to store the file path to the database during database selection, and retrieve this property to load the database.

Also use this same property file to store the network preferences like IP Address and port used in case of a network connection.

Is there a restriction in using properties files in the project do you know ?


Thanks a lot for your comments

Regards!
Geoff Prest
Greenhorn

Joined: Feb 20, 2007
Posts: 17
Hi Ulises

I'm still working on my submission, but from what I've read here on the ranch it is very dangerous (read automatic failure) for your application to rely on the existence of the suncertify.properties file.

A post that eased my concerns about this can be found here.


SCJP 6, SCJA, SCJD in progress
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2268
    
    3

No, no, no. It's not dangerous at all

In the post the guy says "... if not would it be an automatic failure.", but he's actually asking (he used . instead of ? after the phrase!). What needs to happen is, this file is NOT included in the final .jar file. This file is generated in the same working directory of the application. In my case, I used the suncertify.properties file to store all properties of the 3 modes. In standalone mode, I just ask for the .db file location. In server mode, I ask for the .db file location and in which port the server will run. In client mode, I ask for the server IP address and the port in which the server is running.

Take a look at this thread. I think it might be helpful!


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2615
    
    9

Hi having read this I have a question. Why does the database path is needed for server mode? Shouldn't the server's database file already be set? Like clients running the network mode don't care where the database is on the server computer as long as they connected to the serve itself. Right?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
Ulises Pulido
Ranch Hand

Joined: Jul 24, 2008
Posts: 81
K. Tsang wrote:Hi having read this I have a question. Why does the database path is needed for server mode? Shouldn't the server's database file already be set? Like clients running the network mode don't care where the database is on the server computer as long as they connected to the serve itself. Right?


Hi

I believe Roberto is right, I mean when you start in server mode you are only initianting the server, but the server itself does not know where your db file is until you set it, if you are using your GUI only then you have to specify the server hostname/IP Address and port only because the server already is set up with the values provided to it.


I hope this helps
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Database Selection Question