You 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, you set the branch coupling attribute on the resource references for the shared DB2 connections in the application.
Usually, application components can share locks only when those application components are collocated on the same server.
Sharing locks between transaction branches means that multiple DB2 Java Database Connectivity (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.
Sharing 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.
<resource-ref name="jdbc/DataSource_LockSharing" branch-coupling="TIGHT"/>If you do not specify a branch coupling value, the default value of loose is used, that is, transaction branches do not share locks.
You 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; you cannot specify this attribute if annotation has been used.