IBM Support

PI81549: When using SQLJ context caching, auto commit and/or transaction isolation level become inconsistent .

Fixes are available

17.0.0.2: WebSphere Application Server Liberty 17.0.0.2
17.0.0.3: WebSphere Application Server Liberty 17.0.0.3
17.0.0.4: WebSphere Application Server Liberty 17.0.0.4
18.0.0.1: WebSphere Application Server Liberty 18.0.0.1
18.0.0.2: WebSphere Application Server Liberty 18.0.0.2
18.0.0.3: WebSphere Application Server Liberty 18.0.0.3
18.0.0.4: WebSphere Application Server Liberty 18.0.0.4
19.0.0.1: WebSphere Application Server Liberty 19.0.0.1
19.0.0.2: WebSphere Application Server Liberty 19.0.0.2
19.0.0.3: WebSphere Application Server Liberty 19.0.0.3
19.0.0.4: WebSphere Application Server Liberty 19.0.0.4
19.0.0.5: WebSphere Application Server Liberty 19.0.0.5
19.0.0.6: WebSphere Application Server Liberty 19.0.0.6
19.0.0.7: WebSphere Application Server Liberty 19.0.0.7
19.0.0.8: WebSphere Application Server Liberty 19.0.0.8
19.0.0.9: WebSphere Application Server Liberty 19.0.0.9
19.0.0.10: WebSphere Application Server Liberty 19.0.0.10
19.0.0.11: WebSphere Application Server Liberty 19.0.0.11
19.0.0.12: WebSphere Application Server Liberty 19.0.0.12
20.0.0.1: WebSphere Application Server Liberty 20.0.0.1
20.0.0.2: WebSphere Application Server Liberty 20.0.0.2
20.0.0.3: WebSphere Application Server Liberty 20.0.0.3
20.0.0.4: WebSphere Application Server Liberty 20.0.0.4
20.0.0.5: WebSphere Application Server Liberty 20.0.0.5
20.0.0.6: WebSphere Application Server Liberty 20.0.0.6
20.0.0.7: WebSphere Application Server Liberty 20.0.0.7
20.0.0.8: WebSphere Application Server Liberty 20.0.0.8
20.0.0.9: WebSphere Application Server Liberty 20.0.0.9
20.0.0.10: WebSphere Application Server Liberty 20.0.0.10
20.0.0.11: WebSphere Application Server Liberty 20.0.0.11
20.0.0.12: WebSphere Application Server Liberty 20.0.0.12

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When creating a new SQLJ context when context caching is
    enabled (i.e. enableConnectionCasting="true" in server.xml),
    if the auto commit and/or transaction isolation level are
    changed, the values may not be consistent with the
    connection used for the cached context.
    
    For example:
    Connection con = ds.getConnection();
    con.setAutoCommit(false);
    MyCtx ctx = new MyCtx(con);
    
    int id = 1;
    String name = "one";
    #sql [ctx] {INSERT INTO myTable VALUES (:id, :name)};
    // row "one" should be committed into the DB
    ctx.commit();
    
    id = 2;
    name = "two";
    #sql [ctx] {INSERT INTO myTable VALUES (:id, :name)};
    // row "two" should be rolled back and not be present in the
    DB
    // however due to this bug, row "two" will be committed to
    the DB
    ctx.rollback();
    
    BasicIter cursor;
    // Due to this bug, this select will return rows "one" and
    "two", when row "two" should not be in the DB
    #sql [ctx] cursor = {SELECT id, name FROM myTable  WHERE
    id>=1 AND id<=2};
    
    In the above code example, the connection auto-commit has
    been set to FALSE, so data should only be committed to the
    database when an explicit commit is issued.  However, due to
    this bug, the auto-commit FALSE value is not honored, and
    data is auto-committed to the DB.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server Liberty - Java 2 Connectivity (J2C)  *
    ****************************************************************
    * PROBLEM DESCRIPTION: When using SQLJ context caching, auto   *
    *                      commit and/or transaction isolation     *
    *                      level become inconsistent .             *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    When creating a new SQLJ context when context caching is enabled
    (i.e. enableConnectionCasting="true" in server.xml), if the auto
    commit and/or transaction isolation level are changed, the
    values may not be consistent with the connection used for the
    cached context.
    
    For example:
    Connection con = ds.getConnection();
    con.setAutoCommit(false);
    MyCtx ctx = new MyCtx(con);
    
    int id = 1;
    String name = "one";
    #sql [ctx] {INSERT INTO myTable VALUES (:id, :name)};
    // row "one" should be committed into the DB
    ctx.commit();
    
    id = 2;
    name = "two";
    #sql [ctx] {INSERT INTO myTable VALUES (:id, :name)};
    // row "two" should be rolled back and not be present in the DB
    // however due to this bug, row "two" will be committed to the
    DB
    ctx.rollback();
    
    BasicIter cursor;
    // Due to this bug, this select will return rows "one" and
    "two", when row "two" should not be in the DB
    #sql [ctx] cursor = {SELECT id, name FROM myTable  WHERE id>=1
    AND id<=2};
    
    In the above code example, the connection auto-commit has been
    set to FALSE, so data should only be committed to the database
    when an explicit commit is issued.  However, due to this bug,
    the auto-commit FALSE value is not honored, and data is auto-
    committed to the DB.
    

Problem conclusion

  • SQLJ context caching has been fixed to properly synchronize the
    auto-commit and transaction isolation levels of SQLJ context to
    match the values set on the Connection used to create the SQLJ
    context.
    
    The fix for this APAR is currently targeted for inclusion in fix
    pack 17.0.0.2.  Please refer to the Recommended Updates page for
    delivery information:
    http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI81549

  • Reported component name

    LIBERTY PROFILE

  • Reported component ID

    5724J0814

  • Reported release

    CD0

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2017-05-12

  • Closed date

    2017-05-18

  • Last modified date

    2017-05-18

  • 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

    LIBERTY PROFILE

  • Fixed component ID

    5724J0814

Applicable component levels

  • RCD0 PSY

       UP

[{"Business Unit":{"code":"BU053","label":"Cloud \u0026 Data Platform"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"CD0","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
18 October 2021