Skip to content

DBCP Configuration

Mark Rotteveel edited this page Jul 24, 2015 · 3 revisions

This information is outdated

DBCP is an Apache project providing free and open source javax.sql.DataSource and javax.sql.ConnectionPoolDataSource implementation, that can be used with different JDBC drivers. This page contains sample configuration for DBCP with Tomcat 5.0.x.

Sample configuration:

  <Context path="/dbTest" docBase="dbTest" 
           debug="5" reloadable="true" crossContext="true">
 
    <Logger className="org.apache.catalina.logger.FileLogger"
             prefix="dbTest." suffix=".txt" timestamp="true"/>
 
    <Resource name="jdbc/dbTestOld1" auth="Container" type="javax.sql.DataSource"/>
 
    <ResourceParams name="jdbc/dbTest">
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>  
      </parameter>
      <parameter>
        <name>removeAbandoned</name>
        <value>true</value>
      </parameter>
      <parameter>
        <name>removeAbandonedTimeout</name>
        <value>300</value>
      </parameter>
      <parameter>
        <name>logAbandoned</name>
        <value>true</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>SYSDBA</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>masterkey</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>org.firebirdsql.jdbc.FBDriver</value>
      </parameter>
      <parameter>
        <name>url</name>
        <value>jdbc:firebirdsql:localhost/3050:c:/database/EMPLOYEE.GDB</value>
      </parameter>
      <parameter>
        <name>maxWait</name>
        <value>10000</value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>100</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>30</value>
      </parameter>
    </ResourceParams>
 
  </Context>

Alternative (note: FBWrappingDataSource has been deprecated in Jaybird 2.0 and will be removed in Jaybird 3.0)

  <Context path="/dbTest" docBase="dbTest" 
         debug="5" reloadable="true" crossContext="true">
 
    <Logger className="org.apache.catalina.logger.FileLogger"
           prefix="dbTest." suffix=".txt" timestamp="true"/>
 
    <Resource name="jdbc/dbTest" auth="Container"
        type="org.firebirdsql.pool.FBWrappingDataSource"/>
 
    <ResourceParams name="jdbc/dbTest">
      <parameter>
        <name>factory</name>
        <value>org.firebirdsql.pool.FBWrappingDataSource</value>  
      </parameter>
      <parameter>
        <name>userName</name>
        <value>SYSDBA</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>masterkey</value>
      </parameter>
      <parameter>
        <name>database</name>
        <value>localhost/3050:c:/database/EMPLOYEE.GDB</value>
      </parameter>
      <parameter>
        <name>maxPoolSize</name>
        <value>10</value>
      </parameter>
      <parameter>
        <name>minPoolSize</name>
        <value>3</value>
      </parameter>
    </ResourceParams>
 
  </Context>