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

Data file

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

I finished most of the functionalities but still have these 2 questions lingering.

First question: In my spec, there is a requirement which I am not quite to understand .."The new system must reimplement the database code from scratch without altering the data file format..".

I basically open a RandomAccessFile and read the records into array of Strings. I started the first record with an offset of 74, because the first 73 bytes contain header information only. From 74, I read in records with fixed length.. I worked on a copy of the file and that's all so far. So what do they mean by implementing the new database from scratch and then not to alter the format? Do I miss something important here?

Second question: "All numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes. All text values, and all fields contain only 8-bit characters, null terminated if less than the max length for the field. The character encoding is 8 bit US ASCII".

So far, I haven't done anything particular regarding this requirement. Do I need to do something about the DataInputStream and DataOutputStream header format? Do I need to do anything about the 8 bit US ASCII character encoding?

I am working on this test as a way to learn more Java, so please help!!

Thank you very much....
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first means simply that you MUST read and write a particular format as supplied to you. That's a requirement.
The second in part explains what that format actually is. It's not so much a requirement as information needed to be able to meet the previous requirement.
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


First question: In my spec, there is a requirement which I am not quite to understand .."The new system must reimplement the database code from scratch without altering the data file format..".



That means that you cannot add or delete columns from the file, neither can you change the size or type of a column. You have to accept the data file format as is, and altough you could add new rows of data to the file while developing the application, you must not alter its data format at all.
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And remember that you MUST include the original data file as part of your submission.
So do all your testing on a copy!
 
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it mean, that I have to read the given data file and create my own data file (for instance through serialization) and use only this file and the original let untouched? Or I have to update the original after I have read data from it?
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do whatever updates you want in the file while you are testing the application, but deliever the original file when you submit it to Sun for review.
[ December 18, 2006: Message edited by: Edwin Dalorzo ]
 
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pavel Kubal:
Does it mean, that I have to read the given data file and create my own data file (for instance through serialization) and use only this file and the original let untouched? Or I have to update the original after I have read data from it?



What about 'cp db.db db1.db' :roll:
[ December 18, 2006: Message edited by: Mark Smyth ]
 
Pavel Kubal
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark Smyth : Thanks for very clever smile, but don't see any question "how to copy files".

To the others: Maybe I did not make myself clear. I asked whether I am required to create my own database containing data from the original file or I am supposed to update the original file?

I know, that I have to provide original file in my uploaded assignment, but it has nothing to do with my question.

Thanks for your replies.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Henry Le:
Hi all,


First question: In my spec, there is a requirement which I am not quite to understand .."The new system must reimplement the database code from scratch without altering the data file format..".



I think you need to implement database server code only from scratch.
You can (and should) re-use the schema.
In other words, ignore the requirement statement ..
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the requirement talks about code, not data.
You're to write code to offer all database operations (CRUD), implementing the given interface, that's all it says.
It also says you're to submit the original file as part of your submission.

It nowhere says you have to create a new database from scratch.
 
Pavel Kubal
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jeroen, now it is quite clear to me.
 
Mark Smyth
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pavel Kubal:
Mark Smyth : Thanks for very clever smile, but don't see any question "how to copy files".

To the others: Maybe I did not make myself clear. I asked whether I am required to create my own database containing data from the original file or I am supposed to update the original file?

I know, that I have to provide original file in my uploaded assignment, but it has nothing to do with my question.

Thanks for your replies.



Sorry, but I was just making the point that sometime people tend to overcomplicate the SCJD project, when often (not always) what is best is the simplest approach.

Regards,
Mark
 
reply
    Bookmark Topic Watch Topic
  • New Topic