+

Search Tips   |   Advanced Search

Share locks between transaction branches

We can specify that multiple application components on different application servers can share access to data in a single DB2 database under the same global transaction. You specify that the different transaction branches share locks under the global transaction.

To do this, set the branch coupling attribute on the resource references for the shared DB2 connections in the application.

Lock sharing in WebSphere Application Server Version 8 is only supported on DB2; setting lock sharing on a resource reference for a non-DB2 database will result in an exception.

Usually, application components can share locks only when those application components are collocated on the same server.

Share locks between transaction branches means that multiple DB2 JDBC connections to the same database that are in the same transaction, from the same or different servers, can share locks when accessing data. In this way, multiple components can access the data without causing timeouts or other unwanted situations.

Share locks between transaction branches provides the benefit that two Enterprise JavaBeans (EJBs) on two servers can share the visibility of data, and the locks to that data, within a distributed transaction. Therefore, shared access to data does not depend on the location of the application component.

To specify that transaction branches share locks, set the branch coupling attribute on the DB2 resource reference of the application to a value of tight. For example:

If we do not specify a branch coupling value, the default value of loose is used, that is, transaction branches do not share locks.

We can set the branch coupling attribute on the DB2 resource reference of the application by using Rational Application Developer tools. For detailed information, see the Rational Application Developer information center. The application component must have a deployment descriptor; we cannot specify this attribute if annotation has been used.

To share locks between transaction branches in this way, the following conditions apply:

An IBM Support Technote is available that provides a complete list of which DB2 versions support lock sharing. Search the IBM Support Portal for relevant information.


Related tasks

  • Use the DB2 Universal JDBC Driver to access DB2 for z/OS

    Data source minimum required settings for DB2 with the application server on AIX, HP-UX, Linux, Solaris, or Windows

    (zos) Data source minimum required settings for DB2 on z/OS and an application server on z/OS


    Related information:

    IBM Support Portal