transactionCommit (Database - Java)

Makes changes to a database in a batch after a transactionBegin call.

Defined in

Database

Syntax

Database.transactionCommit();

Usage

transactionCommit can be called only after transactionBegin. If the database being changed is closed before transactionCommit is called, all recorded changes are discarded and do not take effect.

Note: For important information about using transaction methods, see Effects of using transaction controls.

Example

try {
   Session session = getSession();
   AgentContext ac = session.getAgentContext();
   Database db = session.getDatabase("myserver", "mydb.nsf");
   db.transactionBegin();
   Document doc = db.createDocument();
   doc.replaceItemValue("Form", "Memo");
   doc.replaceItemValue("Subject", "TestDoc");
   doc.save();
   db.transactionCommit();    
     } catch(Exception e) {
	e.printStackTrace();
}