Programming Guide



xa_commit

Commits an XA-compliant transaction

Synopsis

xa_commit

Environment

Oracle Tuxedo

Scope

Client, Server

Description

The xa_commit command commits the current transaction, initiated by xa_begin. Once initiated, a transaction must be completed by a call to either xa_commit, xa_rollback, or xa_end.

For example, the following transaction calls service DEPOSIT. If successful, the transaction is committed; otherwise, it is rolled back:

xa_begin
service_call "DEPOSIT" ({ACCOUNT, AMOUNT})
if ((@app()->tp_severity > TP_WARNING) \
|| (@app()->tp_return < 0) || (@app()->tp_tran_status < 0))
{
xa_rollback
return 0
}
xa_commit
return 0

xa_commit can set the tp_return property to one of these values:

Exceptions

Execution of xa_commit can generate the following exceptions:

Exception Severity Cause
TP_COMMIT_FAILED
TP_ERROR

Attempt to commit the transaction failed

TP_COMMIT_PARTIAL
TP_WARNING

Transaction has or might have been partially rolled back

TP_COMMIT_ROLLEDBACK
TP_WARNING

Transaction cannot be committed because it has been rolled back

TP_INVALID_CONTEXT
TP_ERROR

Commit operation was attempted outside of a transaction

TP_INVALID_TRANSACTION
TP_ERROR

There is no current transaction

TP_MONITOR_ERROR
TP_ERROR

An error was reported from the middleware

TP_WORK_OUTSTANDING
TP_COMMAND

There is still service request work that has not been completed

See Also

xa_begin, xa_end, xa_rollback