commit()

Commits the active transaction associated with the current connection.

Syntax

void commit()
 

Parameters

None.

Return values

None.

Exceptions

CwDBConnectionException - If a database error occurs.

Notes

The commit() method ends the active transaction by committing any changes made to the database associated with the current connection. The beginTransaction(), commit() and rollBack() methods together provide management of transaction boundaries for an explicit transaction. This transaction contains SQL queries, which include the SQL statements INSERT, DELETE, or UPDATE, and a stored procedure that includes one of these SQL statements.

Important:
Only use commit() if the connection uses explicit transaction bracketing. If the connection uses implicit transaction bracketing, use of commit() results in a CwDBTransactionException exception. If you do not end an explicit transaction with commit() (or rollback()) before the connection is released, InterChange Server Express implicitly ends the transaction based on the success of the map. If the map is successful, ICS commits this database transaction. If the map is not successful, ICS implicitly rolls back the database transaction. Regardless of the success of the map, ICS logs a warning.

Before beginning an explicit transaction, you must create a CwDBConnection object with the getDBConnection() method from the BaseDLM class. Make sure that this connection uses explicit transaction bracketing.

Examples

For an example of committing a transaction, see the example for beginTransaction().

See also

beginTransaction(), getDBConnection(), inTransaction(), rollBack()

Copyright IBM Corp. 1997, 2003