DB2 - Problem description
Problem IC77510 | Status: Closed |
CLI FUNCTIONS RETURN SQL_SUCCESS EVEN WHEN SQL_ATTR_INSERT_BUFFE RING=SQL_ATTR_INSERT_BUFFERING_IGD and INSERT COMMAND FAILS | |
product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problem description: | |
When a call level interface (CLI) application sets the statement attribute SQL_ATTR_INSERT_BUFFERING=SQL_ATTR_INSERT_BUFFERING_IGD and a row, that violates a uniqueness constraint, is inserted in an array input chain, the application ought to get the return value SQL_SUCCESS_WITH_INFO when the CLI array input chain is ended. And then when the application calls SQLRowCount, it ought to report just the number of rows that were successfully inserted, not including any rows that were rejected for violating a uniqueness constraint. As a result of this defect, the application gets the return value SQL_SUCCESS when the CLI array input chain is ended, and SQLRowCount reports the total number of executions of the INSERT statement, including those which violated a uniqueness constraint. This defect only affects applications that connect to a database that has more than one database partition. This defect does not affect DB2 Version 9.7 for Linux, UNIX and Windows before Fix Pack 1. The following pseudocode illustrates the problem. SQLRETURN sql_rc; SQLHANDLE hinsert; SQLINTEGER insertcount; /* Assuming that hinsert is a statement handle that has been allocated, set the statement attribute SQL_ATTR_INSERT_BUFFERING=SQL_ATTR_INSERT_BUFFERING_IGD. */ sql_rc = SQLSetStmtAttr( hinsert, SQL_ATTR_INSERT_BUFFERING, (SQLPOINTER) SQL_ATTR_INSERT_BUFFERING_IGD, 0 ); /* Prepare an INSERT statement. */ sql_rc = SQLPrepare( hinsert, "INSERT INTO MYTEST ( I ) VALUES( ? )", SQL_NTS ); /* Bind the parameters for the INSERT statement. */ sql_rc = SQLExtendedBind( hinsert, ... ); /* Begin an array input chain. */ sql_rc = SQLSetStmtAttr( hinsert, SQL_ATTR_CHAINING_BEGIN, (SQLPOINTER) TRUE, 0 ); /* Insert rows, at least one of which violate a uniqueness constraint. */ sql_rc = SQLExecute( hinsert ); sql_rc = SQLExecute( hinsert ); /* End the array input chain. This ought to set sql_rc to SQL_SUCCESS_WITH_INFO if any of the rows that were inserted violate a uniqueness constraint. But because of the defect it sets sql_rc to SQL_SUCCESS. */ sql_rc = SQLSetStmtAttr( hinsert, SQL_ATTR_CHAINING_END, (SQLPOINTER) TRUE, 0 ); printf( "SQL_ATTR_CHAINING_END returned sql_rc=%d\n", sql_rc); /* Call SetRowCount to set insertcount to the number of rows affected. This statement ought to set insertcount to just the number of rows that were inserted successfully. But because of the defect it sets insertcount to the total number of INSERT statements that were executed, including those which were rejected for violating the uniqueness constraint. */ SQLRowCount( hinsert, &insertcount ); printf( "SQLRowCount returned %d inserted rows\n", insertcount ); | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * Users of CLI (Call Level Interface) applications with DB2 * * for Linux, UNIX and Windows * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * . * **************************************************************** | |
Local Fix: | |
As a workaround you can set the CLI configuration keyword Patch2=111. Setting the CLI configuration keyword Patch2=111 might affect the performance of inserts by CLI applications that set statement attribute SQL_ATTR_INSERT_BUFFERING to either SQL_ATTR_INSERT_BUFFERING_IGD or SQL_ATTR_INSERT_BUFFERING_ON. | |
available fix packs: | |
DB2 Version 9.7 Fix Pack 5 for Linux, UNIX, and Windows | |
Solution | |
Problem was first fixed in Version 9.7 Fix Pack 5. At a minimum this fix should be applied on the client. | |
Workaround | |
As a workaround you can set the CLI configuration keyword Patch2=111. Setting the CLI configuration keyword Patch2=111 might affect the performance of inserts by CLI applications that set statement attribute SQL_ATTR_INSERT_BUFFERING to either SQL_ATTR_INSERT_BUFFERING_IGD or QL_ATTR_INSERT_BUFFERING_ON. | |
BUG-Tracking | |
forerunner : APAR is sysrouted TO one or more of the following: IC77564 IC77565 IC77566 follow-up : | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 13.07.2011 31.10.2011 31.10.2011 |
Problem solved at the following versions (IBM BugInfos) | |
9.7.FP5 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.7.0.5 |