jQuery in Action, 2nd edition*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Database Location - Bodgitt & Scarper 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 Location - Bodgitt & Scarper" Watch "Database Location - Bodgitt & Scarper" New topic
Author

Database Location - Bodgitt & Scarper

Ray Dawson
Ranch Hand

Joined: Sep 16, 2011
Posts: 75
The program must allow the user to specify the location of the database in both standalone and network mode and persist the db configuration details in suncertify.properties file. The application must read the properties file to determine the location of the db and display the data from the db.


So do we place the location of the db file in the suncertify.properties file & read it from there or do we want the user to specify the location of the db file for first time & update that in the properties file ???

And is there anything else that we need to the properties file ???

(I found no similar threads, so)
Please Reply!
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Ray Dawson wrote:So do we place the location of the db file in the suncertify.properties file & read it from there or do we want the user to specify the location of the db file for first time & update that in the properties file ???


Will your properties file exist the first time a user runs the application?

Ray Dawson wrote:is there anything else that we need to the properties file ???


As per your instructions "persist the db configuration details". So you need to store all configuration information that a user can enter in your application. So that should be pretty straight forward? What configuration information can a user enter in your application?

If you are just starting to write code for this assignment, then this is something you could leave until the very end.

Andrew Monkhouse has a good example in his book of how to handle persisting the properties.


SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Ray Dawson
Ranch Hand

Joined: Sep 16, 2011
Posts: 75
Sean Keane wrote:

Will your properties file exist the first time a user runs the application?


Yes, when it loads it has the link to the .db file, which the program reads to access the .db file.

Sean Keane wrote:
As per your instructions "persist the db configuration details". So you need to store all configuration information that a user can enter in your application. So that should be pretty straight forward? What configuration information can a user enter in your application?

Configuration details as in what exactly ?
The user does the search & gets some results, do we need to dump that data into the properties file ? Or what ?

Sean Keane wrote:
Andrew Monkhouse has a good example in his book of how to handle persisting the properties.


Where can I find it ?
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Ray Dawson wrote:
Sean Keane wrote:
Will your properties file exist the first time a user runs the application?

Yes, when it loads it has the link to the .db file, which the program reads to access the .db file.


Then that is up to you whether you decide to store the location of the file or not. There is no wrong or right approach - once it works of course .

Ray Dawson wrote:Configuration details as in what exactly ?

What configuration information do users need to enter in order to use your application?

Ray Dawson wrote:
Sean Keane wrote:
Andrew Monkhouse has a good example in his book of how to handle persisting the properties.
Where can I find it ?


Have you tried Amazon?
Ray Dawson
Ranch Hand

Joined: Sep 16, 2011
Posts: 75
I'm linking the properties file at startup with a default .db location. The program reads it & executes the .db file.
I do have put in Exception Handling at times when say if the db or the prop file is corrupted or something evil happens

Since its the LLC program, I guess the customer calls up CSR's within their needs. CSR's searches a DB & gives them the list of appropriate contractors.
So what config details do I have to log anyways ? Cause I thought properties file was only for storing db locations
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Ray Dawson wrote:So what config details do I have to log anyways ? Cause I thought properties file was only for storing db locations


What configuration information do users need to enter in order to use (start up) your application?
Ray Dawson
Ranch Hand

Joined: Sep 16, 2011
Posts: 75
Sean Keane wrote:
Ray Dawson wrote:So what config details do I have to log anyways ? Cause I thought properties file was only for storing db locations


What configuration information do users need to enter in order to use (start up) your application?


Things like contractor's name, location, specialty, size, rate etc & then search them in the given DB, as far as I understood
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

When you run the application that you have created take a note of the configuration information required to enter in the GUI in order to start it. This is the information that you need to store in the properties file.
Ray Dawson
Ranch Hand

Joined: Sep 16, 2011
Posts: 75
Sean Keane wrote:When you run the application that you have created take a note of the configuration information required to enter in the GUI in order to start it. This is the information that you need to store in the properties file.


The user searches the given db file for the contractor's details, which he enters in the GUI Search Fields.
So do we need to log these random user generated searches into the properties file ? I thought its only for standard properties like db location, etc.
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Does a user have to enter search details to start up your application?
Ray Dawson
Ranch Hand

Joined: Sep 16, 2011
Posts: 75
Sean Keane wrote:Does a user have to enter search details to start up your application?


Yes!
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Ray Dawson wrote:
Sean Keane wrote:Does a user have to enter search details to start up your application?


Yes!


Why?
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5596
    
  15

Ray Dawson wrote:(I found no similar threads, so)

That's very hard to believe! Because it's also one of the most frequent asked quuestions. When I use the search engine with "persistent" I get 270 results which will answer your question without a doubt e.g. (this thread)

Ray Dawson wrote:
Sean Keane wrote:Does a user have to enter search details to start up your application?

Yes!

That's very weird! You would expect the user to start up the application, having to enter the necessary configuration settings (dependent on the mode the application is running in) and when the application is started the user can enter search details over and over again


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Ray Dawson
Ranch Hand

Joined: Sep 16, 2011
Posts: 75
I think I created unnecessary confusion!

Anyway, let me tell you guys about my app:

I start my app without any input from the user.
The search page loads up where the user can input data to be searched in the db file.
After the user clicks search, the app searches db file for matching patterns & returns two sets of results : closest matches, smaller matches(like just part of name etc)
The user can search the data over & over again!
The search results are shown back in JTable & the user can then book the record from them.

So, am kind of confused as to what should I put in the properties file cause the only place I found it mentioned was in the client gui - database section.
I'm logging two sets of files, one for the events happening in the app for future debugging(Event.log), and another one for storing customer profiles(ask them to enter profile info after booking) who booked any contractor(Profiles.log)
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5596
    
  15

And how does your app know where to look for the database file (standalone mode) or for the network server (network client)?
Ray Dawson
Ranch Hand

Joined: Sep 16, 2011
Posts: 75
Roel De Nijs wrote:And how does your app know where to look for the database file (standalone mode) or for the network server (network client)?


I haven't started working on Networking mode as yet.
In standalone mode, the program reads the properties file where I have already put in the default location of the db file.
If the reading fails or the db is not found etc then it asks the user to input the new location of the db file. As the user inputs the new location it updates that in the properties file.
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Well then, it sounds like you have stand-alone mode sorted. No need to worry about what to store for network mode until you implement it, then it should become obvious
Ray Dawson
Ranch Hand

Joined: Sep 16, 2011
Posts: 75
What "other" things should be there in the properties file ??
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5596
    
  15

Ray Dawson wrote:What "other" things should be there in the properties file ??

What settings do you need for networking mode?
Ray Dawson
Ranch Hand

Joined: Sep 16, 2011
Posts: 75
Roel De Nijs wrote:
Ray Dawson wrote:What "other" things should be there in the properties file ??

What settings do you need for networking mode?


As I said I haven't started working on networking mode as yet, as of now working on the standalone version only.
So I really don't kow about the stuff required for networking, hence other than the networking part am asking my first question again - What other things except the db location should i put in the properties file ?
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Ray Dawson wrote:So I really don't kow about the stuff required for networking


That is OK. Once you implement the networking part, then it will all become obvious, and you will know. Simple . No need to worry about it now.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5596
    
  15

Ray Dawson wrote:As I said I haven't started working on networking mode as yet, as of now working on the standalone version only.
So I really don't kow about the stuff required for networking, hence other than the networking part am asking my first question again - What other things except the db location should i put in the properties file ?

So you are not reading the comments and links I provide to you (see some posts above). Good to know I don't have to waste my time anymore.
Ray Dawson
Ranch Hand

Joined: Sep 16, 2011
Posts: 75
Ahhh.. why do I get misunderstood evrytime !!

I just wanted to know other than .db info do we need to put in like say the locked data etc

Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Ray Dawson wrote:do we need to put in like say the locked data etc


What is locked data?
Ray Dawson
Ranch Hand

Joined: Sep 16, 2011
Posts: 75
Lockd data = records which are booked
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5596
    
  15

Ray Dawson wrote:Lockd data = records which are booked

Ah! When you have records that must be locked prior to be updated/deleted your choice of words is very misleading. You could talk about booked contractors, booked records,...

Your search should return all valid records (= records which are not deleted), so also the booked records will be shown in the table. No need to have a seperate view.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Database Location - Bodgitt & Scarper