Page 1 of 1

About Question enthuware.ocpjp.v7.2.1377 :

Posted: Thu Jan 29, 2015 3:22 pm
by ewebxml
This is not best practice:

int supplierID = rs.getInt("SUP_ID");
or
int sid = rs.getInt("SID");

One should use rs.getInt("int_type") when the column type in the table is an int.

----- -----

The question was written like this just to let you know that
if you see it on the exam, it will compile and work.

"An int column in a table can be retrieved using getString()"


http://docs.oracle.com/javase/tutorial/ ... eving.html

Please confirm.

Re: About Question enthuware.ocpjp.v7.2.1377 :

Posted: Thu Jan 29, 2015 9:07 pm
by admin
I am not sure I understand your question. It is true that an int column can be retrieved using getString.

Re: About Question enthuware.ocpjp.v7.2.1377 :

Posted: Thu Jan 29, 2015 9:16 pm
by ewebxml
Best Practices
http://docs.oracle.com/javase/tutorial/ ... eving.html

would discourage using
getString() to retrieve an int column in a table,

but since it can be done,
it is something that one should be aware of for the exam.

Do you agree or disagree?

Re: About Question enthuware.ocpjp.v7.2.1377 :

Posted: Thu Jan 29, 2015 10:52 pm
by admin
Yes, agree.

Re: About Question enthuware.ocpjp.v7.2.1377 :

Posted: Thu Aug 20, 2020 12:37 pm
by Javier
Hi Paul,
Very silly question: is this data rows or columns?
SID INT Primary Key
NAME VARCHAR(50)
GPA INT
columns, isn“t it?
Thank you

Re: About Question enthuware.ocpjp.v7.2.1377 :

Posted: Thu Aug 20, 2020 11:10 pm
by admin
That depends on what you are printing. Whenever you fire a query, it always returns "rows". Depending on what query you have fired, those rows may contain table data or table meta-data (i.e. column details.).