Transaction Control

Team-Fly    

 
DB2 Universal Database for OS/390 v7.1 Application Certification Guide
By Susan Lawson
Table of Contents
Chapter 11.  ODBC/CLI Programming

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 HandleType is SQL_HANDLE_ENV, DB2 will attempt to commit or roll back for each connection handle that was created for the environment handle. If the HandleType is SQL_HANDLE_DBC the commit or rollback will be done only for the specified connection.


Team-Fly    
Top


DB2 Universal Database for OS. 390 v7. 1 Application Certification Guide
DB2(R) Universal Database for OS/390 V7.1 Application Certification Guide (IBM DB2 Certification Guide Series)
ISBN: 0131007718
EAN: 2147483647
Year: 2002
Pages: 163
Authors: Susan Lawson

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net