This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.
  • 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
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

URLyBird Data File Format

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Greetings everybody!I am new to this forum.
As I was trying to use Roberto Perillo's file reader,I found the Record length is missing in my assignment...
Can anybody help me,how to change the code to my use?

And also I dont understand "n bytes,field name" in the following description(of my assignment) .

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


Thanks,
Ramya.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We can't guess who your assignment looks like, so you'll have to post the database structure (schema) of your assignment.
 
Ramya Ramalingam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for replying.I think you are asking for this,

Database schema


The database that URLyBird uses contains the following fields:


Field descriptive name Database field name Field length Detailed description

Hotel Name name 64 The name of the hotel this vacancy record relates to

City location 64 The location of this hotel

Maximum occupancy of this room size 4 The maximum number of people permitted in this room, not including infants

Is the room smoking or non-smoking smoking 1 Flag indicating if smoking is permitted. Valid values are "Y" indicating a smoking room, and "N" indicating a non-smoking room

Price per night rate 8 Charge per night for the room. This field includes the currency symbol

Date available date 10 The single night to which this record relates, format is yyyy/mm/dd.

Customer holding this record owner 8 The id value (an 8 digit number) of the customer who has booked this.
Note that for this application, you should assume that customers and CSRs know their customer ids. The system you are writing does not interact with these numbers, rather it simply records them. If this field is all blanks, the record is available for sale.


Thanks,
Ramya.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you look at the "Data file Format" section? That's the place where my assignment mentions the number of bytes of the magic cookie, length of each record,...
 
Ramya Ramalingam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh!I posted that in my question,but i gave only half information...

Data file Format

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
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


Thanks,
Ramya.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you already tried putting everything with regard to the record length (which you don't have) in comments and just running the tool?
 
Ramya Ramalingam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Roel,

I will get back to you soon.



Thanks,
Ramya.
 
Ramya Ramalingam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Roel,

Sorry,I couldn't get back soon.This is what i did,
1.I commented out all Record length,it works fine.It displayed magic cookie value and all the record values.

2.I set record length value=0; still it works fine.

3.I didn't change anything and run the code as it is,it only displayed like this:


C:\Users\Ramya\Desktop>java DBFileReader
Magic cookie: 259
Record length: 459886
Number of fields in each record: 24941


So it looks like i dont need record length for my assignment


Thanks,
Ramya.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ramya,

There are different versions of assignment: different interfaces to implement, different database file structures,... So it could be your assignment doesn't have a record length in the database file. If everybody had the same assignment, you could easily copy the code from a friend of yours who passed already the SCJD certification. With different assignments it will be a lot harder.

Kind regards,
Roel
 
I'm just a poor boy, I need no sympathy, because I'm easy come, easy go, little high, little low, little ad
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic