Correct Answer: A,B,C
Explanation/Reference:
Explanation:
A:The way to allow two or more statements to be grouped into a transaction is to disable the auto-commit
mode. After the auto-commit mode is disabled, no SQL statements are committed until you call the method
commit explicitly. All statements executed after the previous call to the method commit are included in the
current transaction and committed together as a unit.
Note:When a connection is created, it is in auto-commit mode. This means that each individual SQL
statement is treated as a transaction and is automatically committed right after it is executed. (To be more
precise, the default is for a SQL statement to be committed when it is completed, not when it is executed.
A statement is completed when all of its result sets and update counts have been retrieved. In almost all
cases, however, a statement is completed, and therefore committed, right after it is executed.)
B:The method Connection.setSavepoint, sets a Savepoint object within the current transaction. The
Connection.rollback method is overloaded to take a Savepoint argument. When a transaction is rolled back
to a savepoint all changes made after that savepoint are undone.
C: calling the method rollback terminates a transaction and returns any values that were modified to their
previous values. If you are trying to execute one or more statements in a transaction and
get a SQLException, call the method rollback to end the transaction and start the transaction all over
again.