wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Structure of the DB file, what is to be stored Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Structure of the DB file, what is to be stored" Watch "Structure of the DB file, what is to be stored" New topic
Author

Structure of the DB file, what is to be stored

Aruneesh Salhotra
Ranch Hand

Joined: May 12, 2004
Posts: 167
Hi,
I am looking the DB spec in the assignment.
It says that the DB is structured in the following manner.
-magicnumber, zerorecord,fields
-n timesfieldnamesize,fieldname,fieldlength
-data

in data, it specifies, fixed length strings. Say the name is 64 bytes. Does the file need to have all 64 characters filled. If the name is "hilton", what do we do with the remaining 58 charcters left blank.

Help is required.
Regards
Aruneesh
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Have you tried to print out your data file contents? For my UrlyBird assignment, the remaining characters are all whitespaces. So I'd follow the convention of the data file.


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
Aruneesh Salhotra
Ranch Hand

Joined: May 12, 2004
Posts: 167
How are you writing to the DB file.
I am unclear as to what the format of the file is supposed to be.
The magic number, header are all written using DataOutputStream, which is like binary.

Rest all the data is all written in US-ASCII, which means in the file it should appear as clear-text.
If above is not correct, do let me know what is to be done.

If above is correct, what is the approach we need to take.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Hi Aruneesh,

Have you written a small program to read the data file? Some of your questions may be answered if you see what is currently in place.

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Structure of the DB file, what is to be stored
 
Similar Threads
NX: Bodgitt and Scarper: what to do with the db-2*3.db file? write a parser? and...
Should we always use RandomAccessFile
All numeric values are stored in the header information
What do we mean by this?
Data file format from new assignment