JBoss.orgCommunity Documentation

Chapter 6. Connection Pooling

6.1. Overview
6.2. Framework Overview
6.3. Using Connection Pooling
6.4. The Connection Lifecycle
6.4.1. XAConnection Pooling
6.5. Configuring the Connection Pool

The Query Engine logically obtains and closes a connection for each command.

However many enterprise sources connections can be persistent and expensive to create. For these situations, Teiid provides a transparent connection pool to reuse, rather than constantly close, connections.  The connection pool is highly configurable through configuration properties and extension APIs for Connections and Connectors

Many built-in connector types take advantage of pooling, including JDBC, Salesforce, and LDAP connectors.

The table below lists the role of each class in the framework.


Automatic connection pooling does not require any changes to basic Connector development. It can be enabled by setting the Connector binding Property ConnectionPoolEnabled=true or by adding the ConnectionPooling annotation, which defaults to enabled=true, to the Connector implementation class. Automatic Connection pooling can be disabled if either setting is false.

It is important to consider providing an implementation for Connection.isAlive to indicate that a Connection is no longer viable and should be purged from the pool. Connection testing is performed upon leases from the pool and optionally at a regular interval that will purge idle Connections. It is also important to consider having the concrete Connector class implement ConnectorIdentity factory if Connections are made for multiple identities. Note that setting connector binding property UseCredentialMap to true will allow connectors extending BasicConnector to have their ConnectorIdentity automatically set based upon the user CredentialMap.

These steps occur when connection pooling is enabled:

The ConnectionPool has a number of properties that can be configured via the connector binding expert properties. Note *. indicates that the property prefix is com.metamatrix.data.pool.