home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Latest versionsfixlist
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Have problems? - contact us.
Register for free anmeldung-x26
Contact form kontakt-x26

DB2 - Problem description

Problem IC77565 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 / 950 - 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.5 for Linux, UNIX and Windows before Fix 
Pack 5. 
 
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.5 Fix Pack 9 for Linux, UNIX, and Windows
DB2 Version 9.5 Fix Pack 10 for Linux, UNIX, and Windows

Solution
Problem was first fixed in Version 9.5 Fix Pack 9. 
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 SQL_ATTR_INSERT_BUFFERING_ON.
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
15.07.2011
07.03.2012
07.03.2012
Problem solved at the following versions (IBM BugInfos)
9.5.FP9
Problem solved according to the fixlist(s) of the following version(s)
9.5.0.9 FixList