Begin Transaction

Begins an explicit transaction for the current connection.

Inputs

Database connection
A CwDBConnection object that represents the database connection.

Exceptions

The Begin Transaction function block can throw the CwDBConnectionException exception if a database error occurs.

Notes

The Begin Transaction function block marks the beginning of a new explicit transaction in the current connection. The Begin Transaction, Commit, and Roll Back function blocks 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 Begin Transaction if the connection uses explicit transaction bracketing. If the connection uses implicit transaction bracketing, use of Begin Transaction results in a CwDBTransactionException exception.

Before beginning an explicit transaction, you must create a CwDBConnection object with the Get Database Connection function block. Make sure that this connection uses explicit transaction bracketing.

Related information

This function block is based on the CwDBConnection.beginTransaction() method. For more information, see beginTransaction().

Copyright IBM Corp. 2004