IBM Support

IT27650: CLI INCORRECTLY CONVERTS AN EMPTY STRING TO 0 FOR WCHAR TO INTEGER CONVERSION

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • When User passes an empty string argument to a Integer column
    with C type SQL_C_WCHAR and hence the conversion SQL_C_WCHAR ->
    SQL_INTEGER, CLI incorrectly passes a value Zero(0) to server
    which is incorrect.
    Correct behavior should be to error out alerting user to pass
    correct data.
    
    Example usecase:
    opt callerror on
    opt echo on
    
    
    sqlallocenv 1
    sqlallocconnect 1 1
    
    sqldriverconnectW 1 0
    "database=DBNAME;hostname=HOSTNAME;uid=newton;pwd=PASSWORD;proto
    col=tcpip;port=xxxx;" -3 255 SQL_DRIVER_NO_PROMPT
    
    sqlallocstmt 1 1
    sqlexecdirect 1 "drop table t2" -3
    sqlexecdirect 1 "create table t2(col1 int, col2 varchar(20))" -3
    sqlprepare 1 "insert into t2 values(?,?)" -3
    
    
    getmem 1 1 SQL_C_WCHAR 10
    getmem 1 2 SQL_C_CHAR 40
    
    
    updatemem 1 sql_c_wchar value 0 ""
    updatemem 2 sql_c_char value  5 "test2"
    
    sqlbindparameter 1 1 SQL_PARAM_INPUT SQL_C_WCHAR SQL_INTEGER 0 0
    1
    sqlbindparameter 1 2 SQL_PARAM_INPUT SQL_C_CHAR SQL_VARCHAR 19 0
    2
    
    sqlexecute 1
    
    sqlexecdirect 1 "select * from t2" -3
    fetchall 1
    
    Above sqlexecute would result in getting a value 0 inserted in
    t2.col1.
    Expected behavior is to return following error:
    CLI0112E  Error in assignment. SQLSTATE=22005
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * all                                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to Db2 11.1.4.6 or higher                            *
    ****************************************************************
    

Problem conclusion

  • Upgrade to Db2 11.1.4.6 or higher
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT27650

  • Reported component name

    DB2 CONNECT

  • Reported component ID

    DB2CONNCT

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2019-01-02

  • Closed date

    2021-03-31

  • Last modified date

    2021-03-31

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

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

Fix information

  • Fixed component name

    DB2 CONNECT

  • Fixed component ID

    DB2CONNCT

Applicable component levels

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M","label":"APARs - z\/OS environment"},"Platform":[{"code":"PF054","label":"z\/OS"}],"Version":"11.1"}]

Document Information

Modified date:
01 April 2021