Gautham Kumar

Greenhorn
+ Follow
since Mar 18, 2014
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Gautham Kumar

Hi Roel,

Thanks a lot for your valuable input.

Please check my updated code:


I could get to "Data Section" "record zero" with seek(70) and using readLine() method print all the data elements in one row.

Question#1: I don't understand schema definition, it is very ambigous. Can you please explain in more details? especially "n bytes (defined by previous entry)"? Are they separated by commas","'s? How to read the schema definition? Is schema definition same as field names and length of each field?

Question#2: How to read "field names" and "field length" which seem to be critical for reading rest of contents.

Question#3: Which methods should i use in Random Access File to read each element in data section as i have ~28 data records? with readLine(), i could print all 28 records in one line.

I am taking one step at a time and could see light at the end of the tunnel :-)

Appreciate your help,

Thanks,
Hi Roel,

Good News!!

Finally, I could read successfully first 3 items using RandomAccessFile:-) and compare the output with that generated from the DB File Reader Tool from Roberto.

Can you please validate?

Output:
Magic cookie value is 514
Offset to start of record zero 70
No of Fields in each record 6

Question#1: Can you please verify/confirm if first 4 bytes are for Magic Cookie, next 4 bytes are for Rec Length and next 2 bytes are for "No of Fields in each record".

Am i in the right direction?

Qustion #2 : The second entry output of "70", is this for "offset to start of record zero" or "record length"? I am confused;-( what exactly is offset ? please explain a little bit about offset?

Question#3 : Are there any spaces between the entries in the DB file? If so, how to skip spaces and jump to next entry using Random Access File?


FYI, My data file format:

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

Thanks,
Special Thanks to Mikalai, Pawel and Roel for your valuable information and motivation!!

I am all pumped up now and ready to take on this certification with passion and entusiasm :-)

As i still have to do this while on a Full Time job like Roel. And Roel has given me additional confidence :-)

I bought the book from Apress, but did not complete reading it :-( As i was confused as to whether start project or complete reading book first

Now i got clarity :-) Thanks, Mikalai.

Thanks everyone !!!
Hi,

Enthuware used to have support for helping with OCMJD assignment. But they are not responding to any queries.

Do we have similar web sites for help with OCMJD assignment.

I am doing this on my own, but wondering if we have 1-1 support which can speed up completing the assignment as the duration to complete is only 6 months:-(

I am nervous as i already used one month and not much progress:-( although Roel is answering all my questions with quick turnaround time :-)

I will continue to complete on my own by taking adavantage of valuable resources in this forum.

Thanks,
Hi Roel,

Two more questions:

1) Magic Cookie : It seems this is in bytes. What validation do we need to do with this. Do we need to convert to int and compare with a known value?
2) I have created a RandomAccessFile to read the db file and i could read the intial content.



Output:
Magic cookie value is 514
No of Fields value is 512

I am not sure if the output i am producing is valid or do i need to convert into anyother datatype and compare?

Once i sort out magic cookie and below items, i will proceed with schema description and data sections.

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


Please let me know,
Hi Roel,

Another quick question, We have db-2x2.db file supplied by Sun.

Our code has method to update the DB. Wondering if we can update this db file while testing.

But in instructions it is mentioned that we need to package original DB file with out any modifications and submit to Sun.

Can you please shed some light here.
Thanks, Roel.

I will implement my own version of DBFileReader to read the database file and take some guidance from Roberto's tool.
Thanks, Roel.

Much Appreciated for the detailed explaination.

I can create my own databasereader and implement all methods of sun interface and use this tool(class) s utility class to read data from the DB file.

Is this an accpetable approach?

Please let me know,
Hi Roberto,

I am trying to understand your tool to read DB file. I could get it working for Bogdit and Scraper exam. This took is really great.

Easpecially the following line the getValue method :

value += (byteArray[i] & 0x000000FF) << shift;

0x000000FF = 255, what exactly are you trying to do in above statement? Are you performing leftshift and reading the file?

Please explain if possible.

I have created following files for Bodgit and Scraper assignment:

1) DatabaseException.java(extends Exception)
2) RecordNotFoundException.java(extends DatabaseException)
3) DuplicateKeyException.java(extends DatabaseException)
4) DatabaseFileReader.java(Taking idea from roberto-perillo tool to read .db file) This is working.
5) Created interface LocalDB.java(Extends DB.java which is the interface provided by Sun)

All above packages are in compiled state as i resolved all compile errors.

I am working on step#1 of Roberto Perillo's paper.

Can you please guide me next step.

Hi Roberto,

I have completed SCJP, SCWCD, SCBDC and now i am attempting OCMJD. I am always grateful to this forum which helped to achieve these certifications.

Today i downloaded Bodgit and Scarper assignment. I downloaded your paper and was reading it for the last few days.

It is excellent piece of work. You should attempt to write a book "cracking OCMJD assignment" with the help of some experts from this forum.

I also tried your tool to read the db file and it was seemless after modifying "RECORD_FLAG_BYTES = 2" as Roel mentioned it is either 1 or 2 depending on assignment.

I could display the db file content instantly after running your tool by reading my db file.

one question, You have declared "VALID = 0;" but in my assignment says "00 implies valid record, 0x8000 implies deleted record".

Do i need to worry about this field?

Also any suggestions or tips on where to go from here? Can i proceed with implementing the server? Please let me know