Marks the starting point of a user-defined transaction.
begin tran[saction] [transaction_name]
Usage
When the Distributed Transaction Manager (DTM) is enabled, DTM handles all transaction processing for servers of server class ASEnterprise with a version of 12.0 or later.
If the Adaptive Server is configured with strict dtm enforcement = 1, any attempt to include a remote server in the transaction that has a server class other than ASEnterprise will cause the transaction to be aborted.
For all server classes, when Adaptive Server receives a begin transaction command, an internal state is set which marks the beginning of a transaction. At this point, Component Integration Services is not involved, and the command is not immediately forwarded to remote locations.
transaction_name is not used by Component Integration Services in this release.
Transaction process for servers in class ASEnterprise with a version prior to 12.0 is identical to that of server class sql_server (release 10.0 or later).
When DTM is not enabled, transaction processing for all servers in class ASEnterprise is identical to that of server class sql_server (release 10.0 or later).
Component Integration Services checks the transaction state of the connection to a server of class ASEnterprise. If the internal transaction state indicates that a transaction is in progress, and the state of the connection to the remote participant indicates that no transaction is in progress, Component Integration Services informs the Distributed Transaction Manager that the server has become a participant in the transaction. The Distributed Transaction Manager then issues a BeginXact RPC to the remote server.
Transaction processing for servers in class ASAnywhere is identical to that of server class sql_server (release 10.0 or later).
Transaction processing for servers in class ASIQ is identical to that of server class sql_server (release 10.0 or later).
Component Integration Services checks the transaction state of the connection to a server of class sql_server. If the internal transaction state indicates that a transaction is in progress, and the state of the connection to the server indicates that no transaction is in progress, Component Integration Services forwards the begin transaction command to the server prior to forwarding the first command to that server. In the example below, assume tables t1 and t2 are both located on the same remote SQL Server:
begin transaction
insert into t1 values (...) update t2 ...
commit transaction
At the time the begin transaction command is processed, no interaction with the remote SQL Server occurs.
When the insert command is processed, the transaction state of the connection to the server that owns t1 is checked. Since this is the first command within the transaction, the connection is in a NO TRANSACTION ACTIVE state, and the begin transaction command is forwarded to the server. The insert command is then forwarded to the remote location, and the transaction state for the connection is marked as TRANSACTION ACTIVE.
When processing the update command, the transaction state of the server that owns table t2 is checked. Since it is the same server that owns table t1, it is in the TRANSACTION ACTIVE state, and the begin transaction command is not forwarded.
These comments apply only to release 10.0 or later, which supports cursors. For pre-release 10.0 SQL Server and Microsoft SQL Server, transaction handling is similar to server class db2, described below.
Transaction processing for servers in class direct_connect is identical to that of server class sql_server (release 10.0 or later).
Transactions are supported only at the statement level for servers in class db2. When the internal state of a client connection indicates that there is an active transaction, Component Integration Services precedes each statement forwarded to the server with a begin transaction command. Component Integration Services then issues a commit or rollback transaction (depending on the success or failure of the statement) immediately after the statement is complete.
See Also
begin transaction in the Adaptive Server Reference Manual.