Database connection pooling

The forthcoming 2.0 release of Jackrabbit will feature connection pooling for database components (also see JCR-1456). Connection pooling has been added to:

  1. The database data store components: and subclasses.

  2. The database filesystem components: org.apache.jackrabbit.core.fs.db.DatabaseFileSystem and subclasses.

  3. The database journal components: org.apache.jackrabbit.core.journal.DatabaseJournal and subclasses.

  4. The database bundle persistence managers: org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManager and subclasses.

Important: Please note that the pooling implementations of the bundle persistence managers have not replaced the original implementation but have been added in a separate package.

The components can be configured in the same way as before via the repository descriptor (also see ConfigurationOverview and Jackrabbit configuration). The components that have the same database URL, driver and user will share the same connection pool (with an unlimited number of connections). Thus, existing deployments can easily be migrated to use pooling: The only change needed is to replace any bundle persistence manager class by it's twin brother from the pooling package.

A new configuration element has been added to the repository descriptor: the DataSources element in which you can explicitly configure one or more pooling data sources. Each DataSource has a logical name which can be used in the configuration of the above mentioned components. Here follows an example.

Note: the logicalName parameter of the DataSource element has been replaced by the name attribute as of 2.0-beta5.

<?xml version="1.0"?>
        <DataSource name="ds1">
            <param name="driver" value="oracle.jdbc.driver.OracleDriver" />
            <param name="url" value="jdbc:oracle:thin:@localhost:1521:xe" />
            <param name="user" value="usr" />
            <param name="password" value="pwd" />
            <param name="databaseType" value="oracle"/>
            <param name="validationQuery" value="select 'validationQuery' from dual"/>
            <param name="maxPoolSize" value="10"/>
    <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
        <param name="dataSourceName" value="ds1"/>
        <param name="schemaObjectPrefix" value="fs_" />
    <DataStore class="">
        <param name="dataSourceName" value="ds1"/>
        <param name="schemaObjectPrefix" value="ds_" />
    <Security appName="Jackrabbit">
        <SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager" workspaceName="security" />
        <AccessManager class="" />
        <LoginModule class="">
           <param name="anonymousId" value="anonymous"/>
           <param name="adminId" value="admin"/>
    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" maxIdleTime="2"/>
    <Workspace name="${}">
        <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
            <param name="dataSourceName" value="ds1"/>
            <param name="schemaObjectPrefix" value="fs_${}_" />
        <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
            <param name="dataSourceName" value="ds1"/>
            <param name="schemaObjectPrefix" value="pm_${}_" />
        <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
            <param name="path" value="${wsp.home}/index"/>
    <Versioning rootPath="${rep.home}/version">
        <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
            <param name="dataSourceName" value="ds1"/>
            <param name="schemaObjectPrefix" value="fs_ver_" />
        <PersistenceManager class="rg.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
            <param name="dataSourceName" value="ds1"/>
            <param name="schemaObjectPrefix" value="pm_ver_" />
    <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
        <param name="path" value="${rep.home}/repository/index"/>

Note that you can use data sources from JNDI in both the configuration of the data sources and in configuration of the components (see UsingJNDIDataSource). Jackrabbit will use these JNDI data sources as-is and will not wrap pools around them.

The configuration options for the data source elements are the following:

Required properties:

Optional properties (typically used with non-JNDI data sources):

Optional properties for non-JNDI data sources:

ConnectionPooling (last edited 2010-11-17 13:15:02 by ThomasMueller)