The commit() method of the Connection interface saves all the modifications made since the last commit. con.save() If any issue occurs after the commit you can revert all the changes done till this commit by invoking the rollback() method.
What is commit () method?
The commit() method: The commit() method is used to make sure the changes made to the database are consistent. It basically provides the database confirmation regarding the changes made by a user or an application in the database.
How do you write a commit in Java?
- Import the package.
- Load and Register the driver.
- Create a Connection.
- Create a Statement.
- Execute the Query.
- Process the Results.
- Close the connection.