Committing and Rolling Back Updates to a Database - Java JDBC

Java examples for JDBC:SQL Statement

Description

Committing and Rolling Back Updates to a Database

Demo Code

import java.sql.Connection;

public class Main {
  public static void main(String[] args) throws Exception {
      Connection connection = null;
      // Disable auto commit
      connection.setAutoCommit(false);//from w  w  w .j a  v a  2s .co  m

      // Do SQL updates...

      // Commit updates
      connection.commit();

      connection.rollback();
  }
}

Related Tutorials