Database pool scopes

In Apache Geronimo, you can deploy database pools with three different scopes. The different scopes and their significance are explained as follows:

  • Server-wide: If your database pool is server-wide, it will be visible throughout the entire server instance. Any application or service that is deployed on the server can then look up and use the connections in that pool. You can also use the @Resource annotation in your application code to get the database pool injected instead of using lookups.

  • Application-scoped: An application-scoped database pool is visible only inside an enterprise application. It is not visible to other enterprise applications or services that are deployed on the same application server that are separate from this enterprise application. All of the different Java EE modules that are packaged inside the enterprise application in whose scope the pool is created will have access to that pool. So if an EAR file has both web and EJB modules, then they will be able to access and use a database pool declared in the EAR file's scope. Note that an application-scoped database pool can still be accessed by another application if it declares a dependency on the application that declares the pool.

  • Client-scoped: A client-scoped database pool is visible only in the scope of the application client which declares it. This scope is used when application clients want to access relational databases. Application clients run inside a client container—that is, separate from the application server—and so they cannot access database pools that are declared on the server side.

Application-scoped database pools can only be deployed with EAR applications. The advantage of using application-scoped database pools is that you can deploy and manage your application and your database pool as a single deployment unit. Standalone web and EJB applications can use server-wide database pools. The advantage of using server-wide database pools is that you can redeploy just the database pool without affecting the deployed applications that use the database pool. You can choose to deploy your database pool as a Server-wide pool or as an Application-scoped pool depending on your requirement.

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

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