IBM Support

Potential data integrity issue when using WebSphere Application Server with Shareable DB2 SQLJConnections

Flash (Alert)


Abstract

WebSphere Application Server applications that use SQLJ and connect to a DB2 database could experience a data integrity issue if shareable connections are configured and the application reuses, or caches, the connection instead of calling close() and then getConnection() each time a connection is needed. Failing to implement the Get - Use - Close pattern for connections might result in the same connection handle being wrapped with two different DB2 connections, which can lead to data integrity issues.

Content

The following must hold true in order for this issue to occur:

  1. The application must:
    • get connections to a DB2 database using a WebSphere Application Server data source
    • use Shareable Connections (which is the default)
    • use a SQLJ application to call prepareSQLJCall() or prepareSQLJStatement() on the connection
    • fail to follow the Get - Use - Close Connection pattern, meaning that the application does not call close() on a connection to return it to the connection pool when it is finished using it, and instead caches and reuses the same connection.
  2. By chance, a connection handle is re-associated to a different managed connection than the one that was previously used.
  3. A destructive query such as an insert that overwrites a value, a delete, a table drop etc, is executed on the newly associated DB2 connection causing loss or corruption of the incorrectly targeted data as the statements are prepared on the old DB2 connection. This issue is most likely to occur for applications that rely heavily on the use of cached connections instead of following the Get - Use - Close pattern. A connection might get re-associated to a different managed connection.

This problem is fixed by APAR PI19932 (V7.0) and APAR PI12978 (V8.0/8.5), which are included in WebSphere Application Server V7.0.0.35, V8.0.0.10, and V8.5.5.4.

Workaround:
Using Unshareable connections, rather than Shareable, or changing the application to follow the Get-Use-Close pattern will resolve this problem.

See the following Knowledge Center topics for more information:
Unshareable and shareable connections
Connection handles
Connection pool custom properties

Solutions:
  1. Upgrade to WebSphere Application Server V7.0.0.35 or above.
    Upgrade to WebSphere Application Server V8.0.0.10 or above.
    Upgrade to WebSphere Application Server V8.5.5.4 or above.
  2. Contact IBM Support to request an iFix or ++APAR, as needed. In your opening comments for the PMR, please identify the fix pack level that you need the interim fix to apply to, including any other iFixes or ++APARs you already have applied.

Cross reference information
Segment Product Component Platform Version Edition
Application Servers WebSphere Application Server for z/OS DB Connections/Connection Pooling z/OS 8.5, 8.0, 7.0

Document information

More support for: WebSphere Application Server
DB Connections/Connection Pooling

Software version: 7.0, 8.0, 8.5

Operating system(s): AIX, HP-UX, IBM i, Inspur K-UX, Linux, Solaris, Windows, z/OS

Software edition: Base, Network Deployment

Reference #: 1699312

Modified date: 20 July 2015