• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

DB header format

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I was wondering could somebody help me out or point me in the right direction. I've just started the SCJD. I was able to extract the first 3 values from the .db file but when I looked at the layout of the information in the .db file it appears as shown below(a partial screen dump from command prompt),

-----------------------------------------------------

♦name location @ ♂specialties @ ♦size ♠ ♦rate ♣owner

-----------------------------------------------------
The different symbols stand for the 2 byte numerics wrapping the field names but it appears that the numerics are missing from after the 'name' field and before the 'location' field. Is this a problem with ht efile sent to me by SUN or should those valuse not be there. Any help is really appreciated.
thanks.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes i have beenhere. use readByte, readShort, etc
 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bert,
Aah....That name sounds too familiar!...
Welcome to the ranch and to the forum!(at last I get the lucky chance to welcome somebody in this forum )

The db file is a binary file, so it is different. It also contains a lot of non-printable ascii characters.You could use a Hex editor to read the data or write a small program to read the file contents.
As Laura suggested, use Java IO API to read/write the file contents. I am using RandomAccessFile for my assignment.You should also go thru your Data File Format section in your instructions document.That explains the data schema of the supplied database file.
 
Bert Ley
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was using readShort and readInt to get the first values and they worked fine. But then when I printed out the file values in DOS there were a few missing but then I used the Hex editor and they seem to be there alright. cheers for the help.

Bert
 
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bert,

Welcome to JavaRanch.

We don't have many rules here, but one we do have is the JavaRanch Official Policy On Displayed Names, which requires your displayed name to show both a first and a last name.

Could you please change your displayed name to meet this policy? You can change it here.

Regards, Andrew
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think the numerics in the db file are confusing.
if i remember correctly, some of them are genuinely numbers in hex form, and some of them go via a text format.

eg, the length of a field is a hex number, and needs to be read as such.
however the capacity of a room is a text number, so needs to be read as an int, and then cast as a char, or something like that.

i could be wrong though ...
 
Every plan is a little cooler if you have a blimp. And a tiny ad.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic