Committing or rolling back in a Db2 for i CLI application

The last step for the transaction processing task is to either commit or roll back the transaction using SQLTransact().

A transaction is a recoverable unit of work, or a group of SQL statements that can be treated as one atomic operation. This means that all the operations within the group are to be completed (committed) or undone (rolled back), as if they were a single operation.

When using Db2® for i call level interface (CLI), transactions are started implicitly with the first access to the database using SQLPrepare(), SQLExecDirect(), or SQLGetTypeInfo(). The transaction ends when you use SQLTransact() to either roll back or commit the transaction. This means that any SQL statements processed between these are treated as one unit of work.