SQL COMMIT TRANSACTION Statement

 <     >         Query Statements       Advanced Statements       Example       Flow Chart       Table of Contents

 

The SQL COMMIT TRANSACTION statement ends a transaction by commiting a transaction that has been started.

ConnectionHandle (input).  This argument must specify a numeric integer value with at least six digits of precision.  The value identifies the connection on which to commit the existing active transaction.  This value must have been returned by a successful SQL CONNECT DATASOURCE statement.

A transaction is started with the SQL START TRANSACTION statement.  Until a transaction is started, all query statements are executed in auto-commit mode.  After a transaction is committed or rolled back, another SQL START TRANSACTION statement must be executed to start a new transaction; otherwise, InstantSQL will revert to auto-commit mode when an SQL statement is executed with the SQL START QUERY statement outside of a transaction.

Committing a transaction makes the changes, if any, made by the transaction permanent in the data source and releases any locks being held to maintain the transaction isolation level.

An SQL COMMIT TRANSACTION statement has no effect if a transaction has not been started with the SQL START TRANSACTION statement for the same connection.

Transactions are a connection level feature.  Transactions may be used on one connection and not used on another connection, even when the two connections are to the same data source.  However, a logical transaction, from the point of view of the application, should not be spread across multiple connections because there is no way to guarantee commit or rollback of the entire transaction.

The driver may close any open cursors on the connection when the transaction is committed.  The SQL DESCRIBE CONNECTION statement returns the data item sql-ConCursorCommitBehavior, which provides information regarding cursor commit behavior for the connection.

SQL COMMIT TRANSACTION Statement Example:

 

           SQL COMMIT TRANSACTION
               sql-ConnectionHandle.

Copyright ©2000 Liant Software Corp.  All rights reserved.