About Question enthuware.ocpjp.v7.2.1377 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
ewebxml
Posts: 77
Joined: Sun Jun 30, 2013 10:04 pm
Contact:

About Question enthuware.ocpjp.v7.2.1377 :

Post 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.

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

I am not sure I understand your question. It is true that an int column can be retrieved using getString.

ewebxml
Posts: 77
Joined: Sun Jun 30, 2013 10:04 pm
Contact:

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

Post 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?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Yes, agree.

Javier
Posts: 66
Joined: Mon Feb 20, 2017 12:31 pm
Contact:

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

Post 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

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.).

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests