Transaction Control

ODBC programs often assume that each SQL statement is a logical unit of work. The setting that controls this is AUTOCOMMIT. For compatibility, the DB2 default setting is 1, which forces a commit (or rollback) for every ODBC function call. To execute multiple ODBC calls in a single logical unit of work (LUW), you must override the setting either in the initialization file or using the SQLSetConnectAttr() or SQLSetEnvAttr() functions.

The SQLEndTran() function is used to commit or rollback an LUW for one or more connections. SQLEndTran() takes a HandleType and Handle along with a CompletionType of SQL_COMMIT or SQL_ROLLBACK.

SQLRETURN SQLEndTran (SQLSMALLINT HandleType, 
                      SQLHANDLE   Handle,
                      SQLSMALLINT CompletionType);

If the ...

Get DB2® Universal Database™ for OS/390™ v7.1 Application Certification Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.