Commit changes

2025-10-31 01:52:08  Updated

Changes are automatically committed during DML operations, which is called the auto-commit mode.

You can disable the auto-commit mode by calling the following method on a Connection object:

conn.setAutoCommit(false);

If the auto-commit mode is disabled, you must call the following method on a Connection object to commit the changes:

conn.commit();

You can also run the following command to roll back the changes:

conn.rollback();

A COMMIT or ROLLBACK operation affects all DML statements executed since the last COMMIT or ROLLBACK operation.

Note

A DDL operation will eventually result in an implicit COMMIT operation. If the auto-commit mode is disabled, the COMMIT operation implicitly commits the DML operations that have not been explicitly committed or rolled back.

Contact Us