Skip to content
Sharp

SQL for Java Devs · interview question

Which statement correctly sets up a JDBC transaction?

Multiple choiceMediumchapter-8-curatedpremiumsql-for-java-devstransactions
Choose one answer
Answer and explanation

Correct answer

B. Connection.setAutoCommit(false);

Why

To manage transactions manually in JDBC, you disable auto-commit mode with connection.setAutoCommit(false). This allows you to explicitly commit or rollback the transaction.

Test yourself on SQL for Java Devs

A free test with instant, explained results. No account needed.

Start free test
All SQL for Java Devs questions →