JDBC allows SQL statements to be grouped together into a single transaction. Thus, we can ensure the ACID (Atomicity, Consistency, Isolation, Durability) properties using JDBC transactional features.
Transaction control is performed by the Connection object. When a connection is created, by default it is in the auto-commit mode. This means that each individual SQL statement is treated as a transaction by itself, and will be committed as soon as it’s execution finished. We can turn off auto-commit mode for an active connection with:
and turn it on again with:
Once auto-commit is off, no SQL statements will be committed (that is, the database will not be permanently updated) until you have explicitly told it to commit by invoking the commit() method:
JDBC stands for
“Java Database Connectivity” JDBC is an API defined in the
javax.sql packages for connecting an arbitrary database to a Java program. JDBC is a set of classes and interfaces written in the Java programming language.