Show TOC

Procedure documentationSharing Connections Locate this document in the navigation structure

 

The connection handling mechanism in AS Java enables the sharing of a single physical connection between multiple users — that is, it supports multiple connection handles associated to a single physical connection. This feature is implemented for optimization purposes and is especially useful when the back-end system allows for establishing a limited number of connections.

For an example about connection sharing, refer to Configuring Transaction-Related JMS Connection Factory Propertie

Recommendation Recommendation

We recommend that you use connection sharing.

End of the recommendation.

Prerequisites

Connection sharing is only possible for transactional resources, which are used in distributed transactions.

To use sharing, you must make sure that:

Procedure

To enable connection sharing, you must set the sharing scope parameter for the resource in the deployment descriptor of the relevant application component that uses the connection.

The sharing scope of a resource is either Shareable or Unshareable.

The following example is a part of the deployment descriptor of an enterprise bean. It defines a shareable resource.

Syntax Syntax

  1. <resource-ref>
    	<res-ref-name>jdbc/CAR_RENTAL_POOL</res-ref-name>
    	<res-type>javax.sql.DataSource</res-type>
    	<res-auth>Container</res-auth>
    	<res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
End of the code.