The commit() method permanently saves all SQL operations performed in a transaction.
In a JDBC transaction, after executing all the necessary operations, calling commit() ensures that the changes are saved to the database. For example, after updating stock quantities and recording a new order, commit() makes these changes permanent.
Additional Notes
What role does commit() play in a JDBC transaction?