aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How to check the B&S db file is in correct format? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "How to check the B&S db file is in correct format?" Watch "How to check the B&S db file is in correct format?" New topic
Author

How to check the B&S db file is in correct format?

adiratha abhivachan
Greenhorn

Joined: Mar 15, 2005
Posts: 8
Hi Readers

I downloaded the assignment db-2x3.db. When I check the contents in the ultraedit editor. I found the first 6 characters are contains only ...... c
haracters.

But In my assignment says

Start of file
4 byte numeric, magic cookie value. Identifies this as a data file
2 byte numeric, number of fields in each record

Schema description section.
Repeated for each field in a record:
1 byte numeric, length in bytes of field name
n bytes (defined by previous entry), field name
1 byte numeric, field length in bytes
end of repeating block

Data section.
Repeat to end of file:
1 byte flag. 00 implies valid record, 0xFF implies deleted record
Record containing fields in order specified in schema section, no separators between fields, each field fixed length at maximum specified in schema information

End of file

I didn't find the magic cookie value in the file.

Any ideas how to verify the file format is correct?

Thanks
Suresh
Olena Golub
Ranch Hand

Joined: Jan 17, 2005
Posts: 113
hi Suresh,
try to read your file from Java
In my assignment I use RandomAccessFile to read the db file.



Hope that will help you.
Olena
[ April 04, 2005: Message edited by: Olena Golub ]

SCJP 1.4<br />SCJD 1.4 (in progress)
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 804
I read mine in a hex editor and it displayed as listed in the schema. Perhaps the editor you have was set to display a period (.) for a non-print character? It's also easy in Java to write a simple GUI to display in hex.


Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
Set ultraedit to display in hex and you will be able to read it just fine. I had the same version as you, and didn't have any problems.


“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
adiratha abhivachan
Greenhorn

Joined: Mar 15, 2005
Posts: 8
Thanks to all.. Let me check the db once again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to check the B&S db file is in correct format?
 
Similar Threads
how to read data from db file
Delete Flag Empty -does this imply record valid?
Can someone explain this in better english for me ?
NX:[URLyBird]Get the correct field values
URLyBird Data File Format