Skip to content
Sharp

SQL for Java Devs · interview question

Which method would you use to explicitly start a transaction in JDBC?

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

Correct answer

D. SetAutoCommit(false)

Why

To explicitly start a transaction in JDBC, you use the setAutoCommit(false) method. This disables the auto-commit mode and marks the beginning of a transaction, allowing you to control when to commit or rollback.

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 →