I am having the B&S assignment and I am at a leel of biginners stage. Reading through different posts I got little idea about RAF, like it has header, scheama etc. If somebody would like to explain in my scenario, greatly appreciated.
When I read my DB file and use System.out.println(raf.length()); Does it mean I donot have any records in my database file ? Please see the discription below. any help is appreciated. I am totally stuck.
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
Database schema The database that Bodgitt and Scarper uses contains the following fields: Field descriptive name Database field name Field length Detailed description Subcontractor Name name 32 The name of the subcontractor this record relates to. City location 64 The locality in which this contractor works Types of work performed specialties 64 Comma separated list of types of work this contractor can perform. Number of staff in organization size 6 The number of workers available when this record is booked Hourly charge rate 8 Charge per hour for the subcontractor. This field includes the currency symbol 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.
Is the db file in the same directory as the class or the location your are executing the java command?
i.e. From your example code you are using the sun.certify package so is the db file under \sun\certify or where you are running the java command? which normally would be above the sun\certify directory
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop