About Question enthuware.ocpjp.v11.2.1166 :

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

Moderator: admin

Post Reply
chufeng
Posts: 2
Joined: Mon Dec 13, 2021 3:49 am
Contact:

About Question enthuware.ocpjp.v11.2.1166 :

Post 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

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

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

Post 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.
If you like our products and services, please help us by posting your review here.

chufeng
Posts: 2
Joined: Mon Dec 13, 2021 3:49 am
Contact:

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

Post by chufeng »

Ok, thanks

Riccardomz
Posts: 4
Joined: Sun May 15, 2022 10:18 am
Contact:

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

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

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

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

Post 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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests