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 problem with DBAccess readRecord method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "problem with DBAccess readRecord method" Watch "problem with DBAccess readRecord method" New topic

problem with DBAccess readRecord method

xi brian
Ranch Hand

Joined: Mar 06, 2008
Posts: 30
in the DBAccess interface, the method called"

public String[] readRecord(long recNo) throws RecordNotFoundException;"

1. why there is a long as argument?
i believe that i could just use datainputstream to read the data from the data.db file.
please explain a little bit here.

2. for the return string[], isn't it supposed to contain all the info of the db file, or just one feild of the info.

thank you
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
Hi Brian,
for the long recNo, you are going to have to figure out how to handle it. A counting/iterating mechanism perhaps. I have a Map with the recNo as the key and an ArrayList of Strings with the rest of record as the value. The String[] is the individual record (all of the fields of one record). I have 29 records in my file, and 7 fields in each record, without the record number, because you have to deal with that on your own. It isn't already there. Hope that helps. I had trouble with that particular aspect of the project myself.

xi brian
Ranch Hand

Joined: Mar 06, 2008
Posts: 30
thank you for your help

i kind of getting what i suppose to do here
xi brian
Ranch Hand

Joined: Mar 06, 2008
Posts: 30
i am done with readRecord part,but still a little confused

why readRecord method take an long as an argument, instead of an int ??
I agree. Here's the link:
subject: problem with DBAccess readRecord method
It's not a secret anymore!