How to use Jakarta's DBCP for connection pooling

# How to use Jakarta's DBCP for connection pooling

## Introduction

This HOW-TO provide users with instructions on hot to configure Castor JDO so that Apache Jakarta's DBCP package is used as a connection pool.

## Intended audience

Anyone who wants to use DBCP as connection pool mechanism with Castor JDO.

## Steps

Below are defined the steps to configure Castor JDO to use DBCP's `BasicDataSource` for connection pooling.

### Configuration

To use a DBCP `BasicDataSource` with Castor JDO, please provide the following `<data-source>` entry in the `jdo-conf.xml` file.

      <data-source class-name="org.apache.commons.dbcp.BasicDataSource">
        <param name="driver-class-name" value="com.mysql.jdbc.Driver" />
        <param name="username" value="test" />
        <param name="password" value="test" />
        <param name="url" value="jdbc:mysql://localhost/test" />
        <param name="min-active" value="10" />
        <param name="max-active" value="40" />
      </data-source>

Above example makes use of the mySQL JDBC driver to establish a connection pool to a mySQL instance named 'test' running on the same machine as Castor itself. The pool initially holds 10 connections, but is configured to allow a maximum of 40 active connections at the same time.

## References

- Other pooling examples