Google News
logo
JDBC - Interview Questions
What is the use of Commit and Rollback methods in JDBC?
Commit() method : We have the commit() method in Java to commit the data. Once the SQL execution is done, we can call the commit method.
 
Syntax : connectionobj.commit();
 
Rollback() method : We have the rollback() method in Java to rollback the data. Rollback means to undo the changes. If any of the SQL statements are failed, we can call the rollback method to undo the changes.
 
Syntax : connectionobj.rollback();

Advertisement