• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to see the db.db file using a editor

 
Mannu Sureka
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)
Is there a way to look at the contents of the db.db file directly using a editor. I downloaded a binary editor FxEdit from shareware.com but i could not see the db.db file. So i am just assuming that inorder to look at the db.db file i need to use the functions in the Data.class.


2)
what is the meaning of MAGIC
private static final int MAGIC = 0xC0C0BABE;


3)
What is the meaning of headerLen
private int headerLen;
Thanks in advance,
Ashish.
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3817
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just open it using notepad! It is a text file. Although you'll find some junk chars (which are added to fillup space) but you can still make out.
MAGIC is just a part of their security/protocol or whatever you want to call it. You need not worry about it. Check out read() and write() methods to see how it is used.
-Paul.
------------------
Get Certified, Guaranteed!
(Now Revised for the new Pattern)
www.enthuware.com/jqplus

Your guide to SCJD exam!
www.enthuware.com/jdevplus
Try out the world's only WebCompiler!
www.jdiscuss.com
 
Jim Myers
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mannu Sureka:

2)
what is the meaning of MAGIC
private static final int MAGIC = 0xC0C0BABE;

3)
What is the meaning of headerLen
private int headerLen;
Thanks in advance,
Ashish.

A "magic" value is a value found at the beginning of many data files to validate that the data file is of a format that truly belongs to that application. GIFs, BMPs, etc all have magic numbers in their headers (hedaerLen = Header Length). When a java class is compiled into a .java file, it also gets a "magic" number and its value is 0xC0C0BABE -- the same value used in the test db. I do not know why java's originators used a hex value that is roughly equivalent to Cocoa Babe in English, but something must have inspired them.
 
Abhinav Chandra
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mannu Answers to your queries:
1)Is there a way to look at the contents of the db.db file.
1)The best way will be to write a small program, using Data/DataInfo member methods like getRecordCount, getRecord, toString etc. in order to read the db file and write out its contents in ascii.

2)what is the meaning of MAGIC
2)MAGIC is a number, that is used to check the validity of any particular block of memory. The idea is that if MAGIC is present where you expect to read it from memory then data is good, otherwise if MAGIC is not present at the expected location (that means something corrupted that location), chances are other memory locations (in the near by vicinity of that file) could also have been corrupted and hence the data is then discarded.
3)What is the meaning of headerLen
3)This the length of the Header in the db file. I believe, the idea is to check when you have reached the end of Header (which is MAGIC number) how many bytes you read till then, and then compare it with the headerlen, which should be equal. Again, this is used to check the validity of data file.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic