Page 1 of 1

Re: About Question enthuware.ocpjp.v11.-2-.3630 :

Posted: Tue Apr 13, 2021 4:20 am
by treilhes
Hello, i'm pretty disapointed by this question

One of the expected right answer is : Three SQL statements are executed.

But the table schema is :

Code: Select all

ID(int)  NAME(varchar)   SUBJECT(varchar)
And the update statement query is:

Code: Select all

PreparedStatement insertPS = c.prepareStatement("insert into SUBJECT (NAME, TEACHERID) VALUES (?, ?)");
This query use a wrong column name (TEACHERID != ID) so an sqlexception will be thrown on the first update preventing the execution of the third.
AM i right on this or am i missing something?

As a side note, the code used to prevent SPAM during the registration process does not make sense

Code: Select all

To help us prevent SPAM, tell us what will this code print?: int 1 = 10; System.out.println("hello"+i);:
You can't declare a avariable named "1" and "i" is unknown. Just a typo but a disturbing one during the registration process

Re: About Question enthuware.ocpjp.v11.2.3630 :

Posted: Tue Apr 13, 2021 5:20 am
by admin
You are right. The column name in the query is incorrect.
Fixed.
thank you for your feedback!

PS. Fixe the question spam settings as well.

Re: About Question enthuware.ocpjp.v11.2.3630 :

Posted: Thu Apr 29, 2021 1:10 pm
by Monteragi
java.png
java.png (42.78 KiB) Viewed 2786 times


I think there is problem with question.

We have only TEACHER table ("given" section)

But second prepared statement try to insert into "SUBJECT" table. But we don't have such table so SQLException should be thrown on this statement execution.

So technically only 2 SQL statement are executed. (the second execution leads to error from data base side).

Please correct me if I'm wrong.

Re: About Question enthuware.ocpjp.v11.2.3630 :

Posted: Thu Apr 29, 2021 10:29 pm
by admin
Since none of the option is about an error due to lack of SUBJECT table, you may safely assume that such a table exists.
The problem statement has now been updated to make it clear nevertheless.
thank you for your feedback!