IBM Support

IT18820: WHEN RUNNING THE DYNAMIC SQL IN A PACKAGE, THE WRONG STATEMENT COULD BE PICKED UP, RESULTING IN WRONG RESULT.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • This problem surfaces when running a jdbc or sqc package with
    dynamic SQL with 2 or more dynamic SQL statements in the
    package. And these consequite sql statements are identical in
    everything but literal values concatenated into sql through a
    separate variable. The second prepared statement in package can
    be mapped to the previously prepared statement in the package
    cache.  This leads the newly prepared statement to be executed
    as the previous statement in the package and thus leading to
    wrong results.  The problem surfaces when we have NULL bytes
    in a literal for the SQL statements.
    
    Here is snip of example code in Java for reference.
    -----
            :
    
        String key1 = new String('AAAAA');
        String key2 = new String('BBBBB');
    
        byte [] r1 = { (byte)0x00, (byte)0x00, (byte)0x00,
            (byte)0x00, (byte)0x00 };
        byte [] r2 = { (byte)0xff, (byte)0xff, (byte)0xff,
            (byte)0xff, (byte)0xff };
    
        String range1 = new String( r1 );
        String range2 = new String( r2 );
    
            :
    
        PreparedStatement pstmt1 = con.prepareStatement("SELECT *
          FROM T1 WHERE C1 BETWEEN '" + range1 + "'
          AND '" + range2 + "' AND C2 = '" + key1 + "'");
    
            :
    
        PreparedStatement pstmt2 = con.prepareStatement("SELECT *
          FROM T1 WHERE C1 BETWEEN '" + range1 + "'
          AND '" + range2 + "' AND C2 = '" + key2 + "'");
            :
    -----
    Even if key1 differs to key2, second query returns the same
    results as same as the first select statement.
    

Local fix

  • No workaround available.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * DB2 UDB Version 11.1                                         *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to Version 11.1 Mod Pack 1 Fix Pack 2.               *
    ****************************************************************
    

Problem conclusion

  • Problem was first fixed in DB2 UDB Version 11.1 Mod Pack 1 Fix
    Pack 2.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT18820

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2017-01-13

  • Closed date

    2017-06-23

  • Last modified date

    2017-06-23

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

    IT18732

  • 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

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
29 June 2020