IBM Support

IT18732: 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 10.5                                         *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to Version 10.5 FixPack 9.                           *
    ****************************************************************
    

Problem conclusion

  • Problem was first fixed in DB2 UDB Version 10.5 FixPack 9.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT18732

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    A50

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    YesHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2017-01-10

  • Closed date

    2017-09-27

  • Last modified date

    2017-10-12

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

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

    IT18817 IT18818 IT18820

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • RA50 PSN

       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":"10.5","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
12 October 2017