aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Question on db.db 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 "Question on db.db" Watch "Question on db.db" New topic
Author

Question on db.db

Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi all,
Decided to knuckle down and work on the SCJD assignment. In reading the various posts I notice most of you mention modifying db.db. My instructions say:


"The suncertify/db directory in this distribution also contains your database file, "db.db". You may not modify this file, but you may move it if you wish."


Did anyone else have a similar instruction?
I've been thinking that I'll have to implement a separate db that gets loaded with the flight info and then modify that or create a separate object that stores the total seats and booked seats and save it when the server closes.
Any advice would be appreciated.
Thanks

------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
[This message has been edited by Jane Griscti (edited July 20, 2001).]



Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Kevin Yip
Ranch Hand

Joined: Oct 17, 2000
Posts: 110
I've the same instruction. According to my instruction, I don't need to bother with the total seats. I just need to know the no. of seats available at this instant, and that is stored as the last element of every string of record in the member RAF db of the Data object.
Rick Fortier
Ranch Hand

Joined: Jun 04, 2001
Posts: 147
I don't think they meant that when someone books a flight you can't modify the db.db file. I think what they meant was that you can't alter the structure of it.
If you couldn't modify it, then you would have to write all of the seat information to another file. I haven't read any discussions of anyone doing it that way.
My .02, and I passed.
Kevin Yip
Ranch Hand

Joined: Oct 17, 2000
Posts: 110
I believe 'may not modify' just means you've to upload it in its original status exactly as the time you downloaded it. So, after you played around with it you still have to replace it with the original one before uploading.
It's very likely that different candidates may get different versions of db schema or records so Sun have to check against it. Or Sun has written certain testing routines to assess your assignment and that have to be applied on the original record to obtain expected results. If you add some junk records, it's likely their testing would fail! - No, that means you'll fail!
If a database cannot be modified and updated, what is its practical purpose??
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Originally I thought they were just refering to the db.db structure, as Kevin said, what's the use of a db that can't be modified or updated. Then I saw the Data class had two ctors,
Data(String dbname) to open an existing file.
Data(String dbname, FieldInfo[] fields) to create a new db file.
So I thought maybe they expect me to create and use another db. Plus the instructions for command line args list "Data file name(s)" as valid, implying more than one db can be used.
Rick, Were your instructions worded the same way "may not modify"??
Thanks
Jane
Shailendra Guggali
Ranch Hand

Joined: Feb 01, 2001
Posts: 86
hi jane
1. I feel the second constructor is for "future use" - just in case you want to add new tables like linking to customer data or the payment for the ticket etc.
2. by the command line argument for DB file - they might mean the location of the file - " they say you can move it ".
3. my instructions also say that " you may not modify this file "
I am also struggling with the FBN assignment - pls shed more light on this db.db issue
thanx
shail
Rick Fortier
Ranch Hand

Joined: Jun 04, 2001
Posts: 147
Yes it says "may not modify"
I believe that in order to understand some of the strange things about Data one must understand the history of the assignment. In previous versions, candidates were asked to create a tool that would create the database and migrate files from text to the binary file. So that is what the second constructor is for.
Also that is why the writeRecord and delete methods are there. the conversion tool had to insert new records, and during this course if any error occurred, they were required to rollback the database to what it was before import began. So they would have to use the delete method to do the rollback.
I hope that this puts it in a better perspective.
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Great. Thanks Rick.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on db.db