File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Reading fields' information of DataBase Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Reading fields Watch "Reading fields New topic
Author

Reading fields' information of DataBase

Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231
Hi,

there is nothing in the assignment that says that we have to read fields' information of the database (such as field length, name etc).

but if we want our GUI to be separate from the DB layer i think we should read that kind of information of the DB and provide the functionality of querying that info to the Data class to allow the GUI to be as separate as possible.

not quite sure if i made my point clear but what do you think ? is there anyone who didn't read the DB fields of the database and passed with an excellent/ V.Good grade?


SCBCD - SCWCD - SCJD - SCJP - OCA
Peter Hat
Greenhorn

Joined: Oct 29, 2007
Posts: 6
The way I read it, it's your choice if you want to hard code the field names or to read them dynamically, and I think both can be ok, as long as you documents what considerations you went through while you reached your decision.

The documentation of your thoughts and reasons for your decisions, is more important than your actual choices, as I understand it.
Terence Lai
Greenhorn

Joined: Dec 09, 2007
Posts: 8
How about the order of the fields? Are they always in the same order as shown in the sample database file?

Can I hardcode the order of the fields as shown in the sample database file? This will make the implementation easier.

Alternately, my program will need to read the schema description from the database file and find out the order of the fields dynamically.

Thanks,
Terence
Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516
Hi,

well.. the sample database IS your database, so whatever order the fields are in is the order they are..

And the magic cookie allows you to identify that the file is really your database.. So SUN will only be able to use the correct database with your application...

As for handling that dynamically or not, it's a design choice.. However, I believe you will have to write the code (throwable or not) to find the exact size of your header.. might as well read the value, keep the code and do it dynamically

Regards,
Alex
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading fields' information of DataBase