Page 1 of 1

About Question enthuware.ocpjp.v11.2.1166 :

Posted: Mon Dec 13, 2021 3:53 am
by chufeng
Given that a code fragment has just created a JDBC Connection and has executed an update statement, which of the following statements is correct?
There's no code fragment in desktop version

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

Posted: Mon Dec 13, 2021 6:12 am
by admin
There is no need for a code fragment. Code fragment is not relevant in this question that is why it is not given. All you need to know is that a JDBC Connection was created and then an update statement was fired.

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

Posted: Wed Dec 15, 2021 4:54 am
by chufeng
Ok, thanks

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

Posted: Sun May 15, 2022 10:35 am
by Riccardomz
I don't think this question is correctly asked as it states:
Given that a code fragment has just created a JDBC Connection and has executed an update statement
An invisible fragment of code create a JDBC Connection, but it does not specify HOW such fragment creates such connection. Let me explain: this fragment of code can actually comply with the question:

Code: Select all

try (Connection conn = DriverManager.getConnection(dbURL);
		Statement stat = conn.createStatement()) {
			conn.setAutoCommit(false);
			stat.executeUpdate("CREATE TABLE Phone (Name CHAR(20), Number INT)");
			stat.executeUpdate("INSERT INTO Phone VALUES ('Shaun Sheep', 1234567)");
}
It has just created a JDBC Connection and has executed an update statement.
To be more clear, in my opinion the question should specify precisely that no other methods are invoked on the Connection instance before the update statement being executed. So it become clear that the aim of the question is to test whether you know the auto-commit default of a JDBC connection.

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

Posted: Sun May 15, 2022 12:21 pm
by admin
By that logic, there could be a hundred other statements in between creation of the connection and execution of a statement and still be compliant.

Also, the problem statement does use the word "just", so, the most logical conclusion is that only those two things have happened (creation of a connection and execution of a statement.)

But yes, the wording can be improved to avoid this deliberate misinterpretation.