Committing and Closing the Connection


By default, DML operations (INSERT, UPDATE, DELETE) are committed automatically as soon as they are executed. This is known as auto-commit mode. You can, however, disable auto-commit mode with the following method call on the Connection object:
   conn.setAutoCommit(false);
If you disable auto-commit mode, then you must manually commit or roll back changes with the appropriate method call on the Connection object:

   conn.commit( );
or:
   conn.rollback( );

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

Note that: You must close your connection to the database once you finish your work. Use the close method of the Connection object to do this:
   conn.close( );
Typically, you should put close( ) statements in a final clause.




      “We learn from failure, not from success!”    
      ― Bram Stoker, Dracula