Creating an application-scoped database pool

An application-scoped database pool is visible only within the scope of the application. It is available to all of the modules that are present within an enterprise application (for example, war, ear, jar, and so on). It can also be made visible to other applications if they declare a dependency on the application containing the database pool. You can deploy an application-scoped database pool by adding an ext-module element to the application's Geronimo specific deployment plan.

To illustrate this, we have provided a sample application. This sample application is present at samplesChapter-3 Database ConnectivityJDBC Sample ear. The ext-module section in the geronimo-application.xml file of the JDBC sample EAR application is shown below:

<ext-module>
<connector>JDBCDataSource</connector>
<external-path xmlns:dep="http://geronimo.apache.org/xml/ns/ deployment-1.2">
<dep:groupId>org.tranql</dep:groupId>
<dep:artifactId>tranql-connector-derby-embed-xa </dep:artifactId>
<dep:type>rar</dep:type>
</external-path>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
<resourceadapter>
<outbound-resourceadapter>
<connection-definition>
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
<connectiondefinition-instance>
------------------------------
------------------------------
------------------------------
</connectiondefinition-instance>
</connection-definition>
</outbound-resourceadapter>
</resourceadapter>
</connector>
</ext-module>

The sections with dashes are actually the same as those shown earlier in the plan.xml file.

It has the following elements that are not present in the deployment plan for a server-scoped database connection pool:

  • connector: Name of the connector.

  • external-path: Defines the TranQL resource adapter that will be used to deploy the connector plan. It consists of groupId, artifactId, type, and so on, which are used to identify the resource adapter in the Geronimo repository.

After these two elements, the plan is identical to the one for the server-scoped database pool. Note that the dependencies present in the server-scoped plan are not present in the connector section of the application plan, as they are added as a dependency for the entire application. There is also no dependency on the database pool in the application plan, as it is contained in the application itself.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.34.85