IBM Support

IT08281: 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 V9.7 FP11                                    *
    ****************************************************************
    

Problem conclusion

  • Fixed in DB2 V9.7 FP11
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT08281

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    970

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2015-04-13

  • Closed date

    2015-10-07

  • Last modified date

    2015-10-07

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

    IT05796

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

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • R970 PSY

       UP

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSEPGG","label":"DB2 for Linux, UNIX and Windows"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.7","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
07 October 2015