Begins an explicit transaction for the current connection.
Syntax
void beginTransaction()
Parameters
None.
Return values
None.
Exceptions
CwDBConnectionException--If a database error occurs.
Notes
The beginTransaction() method marks the beginning of a new explicit transaction in 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.
Before beginning an explicit transaction, you must create a CwDBConnection object with the getDBConnection() method from the BaseCollaboration class. Make sure that this connection uses explicit transaction bracketing
Examples
The following example uses a transaction to execute a query for inserting rows into a table in the database associated with connections in the CustDBConnPool.
CwDBConnection connection = getDBConnection("CustDBConnPool", false); // Begin a transaction connection.beginTransaction(); // Insert a row connection.executeSQL("insert..."); // Commit the transaction connection.commit(); // Release the connection connection.release();
See also