There's no code fragment in desktop versionGiven that a code fragment has just created a JDBC Connection and has executed an update statement, which of the following statements is correct?
About Question enthuware.ocpjp.v11.2.1166 :
Moderator: admin
-
- Posts: 2
- Joined: Mon Dec 13, 2021 3:49 am
- Contact:
About Question enthuware.ocpjp.v11.2.1166 :
-
- Site Admin
- Posts: 10064
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.1166 :
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.
If you like our products and services, please help us by posting your review here.
-
- Posts: 2
- Joined: Mon Dec 13, 2021 3:49 am
- Contact:
-
- Posts: 4
- Joined: Sun May 15, 2022 10:18 am
- Contact:
Re: About Question enthuware.ocpjp.v11.2.1166 :
I don't think this question is correctly asked as it states:
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.
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:Given that a code fragment has just created a JDBC Connection and has executed an update statement
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)");
}
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.
-
- Site Admin
- Posts: 10064
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.1166 :
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.
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.
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 98 guests