1. What is Connection Pool? A connection pool contains a group of JDBC connections that are created when the connection pool is registered—when starting up WebLogic Server or when deploying the connection pool to a target server or cluster. Connection pools use a JDBC driver to create physical database connections. Your application borrows a connection from the pool, uses it, then returns it to the pool by closing it. 2. Create a Connection Pool on Geronimo a) Login to Geronimo Console (E.g.: b) In Navigator, click ‘Datasources’, then click the link ‘Using the Geronimo database pool wizard‘. c) Select

  • Name
  • Database: Choose PostgreSQL XA
  • Click Next.

Capture d) Select Driver, JAR, Parameters.

  • Reference to jdbc.properties file.
  • Then, click Deploy


  • Here is result:

Untitled e) Test connection pool with simple query. Capture 3. Configure project a) In web.xml

  • In web.xml insert a resource-ref section declaring the database pool.
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
<!-- servlets and mappings and normal web.xml stuff here

b) In geronimo-web.xml

  • In WEB-INF/geronimo-web.xml 
  • The geronimo-web.xml plan should have a dependency element pointing to the database pool module, and a resource-ref block corresponding to the web.xml resource-ref above, which maps the resource reference to a specific database pool.
  • In that block, the ref-name must match the res-ref-name from the web.xml (above) and the resource-link must point to the database pool by name.
<?xml version="1.0" encoding="UTF-8"?>

c) In hibernate-context.xml

  • In application configuration, here we need to declare a new datasource that reference to the connection pool.
<jee:jndi-lookup id="dataSource" jndiname="
java:comp/env/jdbc/MyDataSource" />
<bean id="sessionFactory"
<property name="dataSource" ref="dataSource" />