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 how to read data from db file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "how to read data from db file" Watch "how to read data from db file" New topic
Author

how to read data from db file

Jofer Chan
Ranch Hand

Joined: Sep 09, 2003
Posts: 49
hi,everyone:
The format of data in the database file is as follows:
Start of file
4 byte numeric, magic cookie value identifies this as a data file
4 byte numeric, offset to start of record zero
2 byte numeric, number of fields in each record
Schema description section.
Repeated for each field in a record:
2 byte numeric, length in bytes of field name
n bytes (defined by previous entry), field name
2 byte numeric, field length in bytes
end of repeating block
Data section. (offset into file equal to "offset to start of record zero" value)
Repeat to end of file:
2 byte flag. 00 implies valid record, 0x8000 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
All numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes. All text values, and all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field. The character encoding is 8 bit US ASCII.
how to write codes to read data from db file?
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11285
    
  59

Hi Jofer,
I would recommend you look at the Sun tutorial on IO, particularly the RandomAccessFile section.
When you are comfortable with the standard I/O classes, you may wish to look at the New I/O APIs (NIO) which give some benefits over RandomAccessFile.
Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Siju Odeyemi
Greenhorn

Joined: Jan 16, 2003
Posts: 10
Originally posted by Jofer Chan:
how to write codes to read data from db file?

Hmmm.. I'm a little perplexed by this db file as well. I have just bought and downloaded my assignment. I'll take a closer look and share my thoughts here soonish.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to read data from db file
 
Similar Threads
.db file format problem, help please!!!
Unable to understand the data file format for URLyBird 1.3.2
URLy 1.1.2 - Reading the DB
Reading the Datafile
Data File Format & Schema File