Potential data integrity issue when using WebSphere Application Server with Shareable DB2 SQLJConnections
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.
The following must hold true in order for this issue to occur:
- 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.
- By chance, a connection handle is re-associated to a different managed connection than the one that was previously used.
- 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 V220.127.116.11, V18.104.22.168, and V22.214.171.124.
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 pool custom properties
- Upgrade to WebSphere Application Server V126.96.36.199 or above.
Upgrade to WebSphere Application Server V188.8.131.52 or above.
Upgrade to WebSphere Application Server V184.108.40.206 or above.
- 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.
|Application Servers||WebSphere Application Server for z/OS||DB Connections/Connection Pooling||z/OS||8.5, 8.0, 7.0|
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