org.apache.james.util.dbcp
Class JdbcDataSource

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.james.util.dbcp.JdbcDataSource
All Implemented Interfaces:
org.apache.avalon.excalibur.datasource.DataSourceComponent, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.thread.ThreadSafe

public class JdbcDataSource
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.excalibur.datasource.DataSourceComponent

This is a reliable DataSource implementation, based on the pooling logic provided by DBCP and the configuration found in Avalon's excalibur code.

This uses the normal java.sql.Connection object and java.sql.DriverManager. The Configuration is like this:

   <jdbc>

     <pool-controller min="5" max="10" connection-class="my.overrided.ConnectionClass">
       <keep-alive>select 1</keep-alive>
     </pool-controller>

     <driver>com.database.jdbc.JdbcDriver</driver>
     <dburl>jdbc:driver://host/mydb</dburl>
     <user>username</user>
     <password>password</password>
   </jdbc>
 

These configuration settings are available:

Version:
CVS $Revision: 494012 $

Field Summary
 
Fields inherited from interface org.apache.avalon.excalibur.datasource.DataSourceComponent
ROLE
 
Constructor Summary
JdbcDataSource()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 void dispose()
           
 java.sql.Connection getConnection()
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcDataSource

public JdbcDataSource()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(Configuration)

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
See Also:
org.apache.avalon.framework.configuration.Configurable#dispose()

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Specified by:
getConnection in interface org.apache.avalon.excalibur.datasource.DataSourceComponent
Throws:
java.sql.SQLException


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.