File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes database with URLyBird Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "database with URLyBird" Watch "database with URLyBird" New topic

database with URLyBird

Robert Aragon

Joined: Jul 11, 2005
Posts: 18
There is an interface Sun wants implemented. It has a series of methods with their signatures. Many of these methods read and write directly to the database.

readRec(long recordNumber) is supposed to read a file out of the database. Is this not a waste of time? Shouldn't the server, upon starting, read the whole database into memory? All clients that access the database access the one in memory. Any modifications are done by the server to the database, if successful, then to the database in memory?


Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11778

Hi Robert,

It sounds like you are proposing a cache for the data - something that many candidates implement, and it certainly doesnt seem to cause loss of marks.

It has been suggested (from memory by Max Habibi) that a cache could be implied in the instructions - the fact that the read method (amongst others) does not throw InterruptedException would work well with in a cached environment (you can have your constructor populate the cache, and the constructor can throw any Exception you like). That still leaves the problem of the update method but nobody said that everything was going to be easy .

However when implementing a cache you need to consider how many records you can hold in memory / what happens if you run out of memory (this is easily answered, but I am leaving that to you).

Whatever you decide, you need to document your design decisions.

Regards, Andrew

The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Tom Henricksen
Ranch Hand

Joined: Mar 23, 2004
Posts: 136

Currently I am working on the B&S Assignment. I currently read all my Contractors in the constructor. I noticed in the Exam Cram book they have a getData method and Max's book has a getDvds(). What are the pros and cons of doing it separately? I guess I thought that since I didn't have a getData method in my interface that I should read all data in in the constructor. That was probably a bad assumption.
I agree. Here's the link:
subject: database with URLyBird
It's not a secret anymore!