• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Unable to understand the data file format for URLyBird 1.3.2

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

Hello all,

I need some help on understanding the data file format and the database schema for my URLyBird 1.3.2 SCJD assignment.
I have very limited Java programming language experience and have never worked with a data file. I have spend days reading/searching through the posts on the forum on the same topic but haven't been able to understand anything properly. Can anyone throw some light in this regard or suggest some reading material for a beginner to understand it. I already have Andrew Monkhouse's book.

I am adding the data format for reference. Please delete it if its not allowed.

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.

Any help will be highly appreciated as I am stuck and desperately want to move ahead.

Thanks a lot,
Bably
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy, Bably! Welcome to JavaRanch!

Some time ago, I created a tool that reads the .db file received with the assignment. Please take a look here. This will help you understanding the schema and start creating your own solution. There are also some threads that discuss this topic and may be helpful to you (please find them here, here and here).
Since you are starting with the development, here's a tip: in this forum, you'll be able to find about 85% of the questions you will still have during your journey. Whenever you have a question, search for the answer in the Search link (it's likely that other people also had it in the past), but if you still feel that your doubt wasn't answered, you may come here and ask it, and we will do our best to help you with it!
 
Bably Das
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks a lot Roberto for the quick reply! I will go through the links provided by you and come back if I have more doubts.

Cheers,
Bably
 
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic