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.
About Question enthuware.ocpjp.v7.2.1377 :
Moderator: admin
-
- Posts: 78
- Joined: Sun Jun 30, 2013 10:04 pm
- Contact:
-
- Site Admin
- Posts: 10067
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1377 :
I am not sure I understand your question. It is true that an int column can be retrieved using getString.
If you like our products and services, please help us by posting your review here.
-
- Posts: 78
- Joined: Sun Jun 30, 2013 10:04 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1377 :
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?
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?
-
- Site Admin
- Posts: 10067
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1377 :
Yes, agree.
If you like our products and services, please help us by posting your review here.
-
- Posts: 66
- Joined: Mon Feb 20, 2017 12:31 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1377 :
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
Very silly question: is this data rows or columns?
SID INT Primary Key
NAME VARCHAR(50)
GPA INT
columns, isn´t it?
Thank you
-
- Site Admin
- Posts: 10067
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1377 :
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.).
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 210 guests