Implement an optimistic concurrency control (OCC) strategy for the Java™ Database Connectivity (JDBC) DMS to diagnose transaction problems that are caused by update collisions.
An update collision occurs when client data that populates a data graph is changed in the database before the data graph can submit the modifications of the client. If you configure the JDBC DMS for OCC, the DMS issues an OCC-specific exception when such a data collision happens. The OCC exception contains collision details such as the original row values, current row values, and the attempted row values. The client application uses these values to determine how to recover from the collision. For example, the application can reread the data and restart the transaction.
Be aware, however, that when one exception occurs, there is no way of knowing whether more exceptions exist deeper in the data graph schema and therefore are not displayed.
To activate OCC for the data mediator service, you must incorporate OCC columns into your database tables.
Add an OCC Integer column to a given table, and specify that this column is to be used for OCC in the metadata. The defined OCC collision column is reserved for the exclusive use of the mediator. If there is no OCC column defined for a table, the DMS does not monitor and notify you of update collisions. The following generic code segments create this setup.
In this information ...Related concepts
Related reference
| IBM Redbooks, demos, education, and more(Index) |