Skip to content
Sharp

SQL for Java Devs · interview question

What happens if you try to commit a transaction when auto-commit mode is enabled in JDBC?

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

Correct answer

D. The transaction is committed immediately

Why

When auto-commit mode is enabled, each individual SQL statement is treated as a transaction and is automatically committed upon execution. Thus, explicitly calling commit() will still commit the transaction immediately.

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 →