Skip to content
Sharp

SQL for Java Devs · interview question

When using JDBC, which method ensures a SQL query is executed as a transaction?

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

Correct answer

A. SetAutoCommit(false)

Why

The setAutoCommit(false) method is used to disable the default auto-commit mode in JDBC, allowing you to manually manage transactions by explicitly committing or rolling back changes.

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 →