IBM Support

IT05796: CLI APPLICATION USING CHAINING WITH INSERT BUFFERING MAY GET SQL_SUCCESS BUT SQLROWCOUNT() GIVES 0.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • An application that is using CLI insert buffering with chaining
    to insert the rows more than once on the same statement handle
    will receive the SQL_SUCCESS when settiing SQL_ATTR_CHAINING_END
    to end the chain. But SQLRowCount() will return 0 saying no rows
    inserted.
    
    
    Steps to reproduce problem :
    ==========================
    opt echo on
    opt callerror on
    quickc 1 1  sample
    sqlallocstmt 1 1
    
    
    sqlsetstmtattr 1 SQL_ATTR_INSERT_BUFFERING
    SQL_ATTR_INSERT_BUFFERING_IGD
    
    sqlexecdirect 1 "create table tab1(id char(10) unique not null)"
    -3
    
    
    sqlexecdirect 1 "insert into tab1 (id) values ('001')" -3
    
    sqlprepare 1 "insert into tab1 (id) values (?)" SQL_NTS
    getmem 1 1 SQL_C_CHAR 30
    sqlbindparameter 1 1 SQL_PARAM_INPUT SQL_C_CHAR SQL_VARCHAR 30 0
    1
    
    sqlsetstmtattr 1 SQL_ATTR_CHAINING_BEGIN 1
    updatemem 1 sql_c_char value SQL_NTS "001"
    sqlexecute 1
    updatemem 1 sql_c_char value SQL_NTS "001"   ### duplicate
    sqlexecute 1
    updatemem 1 sql_c_char value SQL_NTS "001"   ### duplicate
    sqlexecute 1
    updatemem 1 sql_c_char value SQL_NTS "001"   ### duplicate
    sqlexecute 1
    updatemem 1 sql_c_char value SQL_NTS "001"   ### duplicate
    sqlexecute 1
    updatemem 1 sql_c_char value SQL_NTS "001"   ### duplicate
    sqlexecute 1
    
    sqlsetstmtattr 1 SQL_ATTR_CHAINING_END 1
    
    sqlrowcount 1
    
    sqlbindparameter 1 1 SQL_PARAM_INPUT SQL_C_CHAR SQL_VARCHAR 30 0
    1
    updatemem 1 sql_c_char value SQL_NTS "003"
    sqlexecute 1
    sqlbindparameter 1 1 SQL_PARAM_INPUT SQL_C_CHAR SQL_VARCHAR 30 0
    1
    
    
    
    sqlsetstmtattr 1 SQL_ATTR_CHAINING_BEGIN 1
    updatemem 1 sql_c_char value SQL_NTS "002"
    sqlexecute 1
    updatemem 1 sql_c_char value SQL_NTS "004"
    sqlexecute 1
    updatemem 1 sql_c_char value SQL_NTS "005"
    sqlexecute 1
    updatemem 1 sql_c_char value SQL_NTS "006"
    sqlexecute 1
    updatemem 1 sql_c_char value SQL_NTS "007"
    sqlexecute 1
    updatemem 1 sql_c_char value SQL_NTS "008"
    sqlexecute 1
    
    
    sqlsetstmtattr 1 SQL_ATTR_CHAINING_END 1
    
    sqlrowcount 1
    
    
    sqltransact 1 1 sql_rollback
    sqlfreestmt 1 sql_drop
    killenv 1
    
    
    In the above case, first SQL_ATTR_CHAINING_END will fail because
    all the rows are duplicate and returns the SQLRowCount as
    0.(Value returned here depends on the number of rows
    successfully inserted)
    But during the 2nd chaining all the rows are good rows, so
    SQL_ATTR_CHAINING_END should receives SQL_SUCCESS with correct
    row count. Instead SQLRowCount() API is returning 0 or incorrect
    result.
    

Local fix

  • NA
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * All                                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 V10.5 FP6                                     *
    ****************************************************************
    

Problem conclusion

  • Please see Above.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT05796

  • Reported component name

    DB2 CONNECT

  • Reported component ID

    DB2CONNCT

  • Reported release

    A50

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2014-11-26

  • Closed date

    2015-09-01

  • Last modified date

    2015-09-01

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

    IT08280 IT08281

Fix information

  • Fixed component name

    DB2 CONNECT

  • Fixed component ID

    DB2CONNCT

Applicable component levels

  • RA50 PSN

       UP

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M"},"Platform":[{"code":"PF054","label":"z Systems"}],"Version":"10.5","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
19 June 2020