Class DBCPDriverDataSource

java.lang.Object
org.apache.openjpa.jdbc.schema.SimpleDriverDataSource
org.apache.openjpa.jdbc.schema.DBCPDriverDataSource
All Implemented Interfaces:
Wrapper, CommonDataSource, DataSource, DriverDataSource, Configurable, Closeable
Direct Known Subclasses:
AutoDriverDataSource

public class DBCPDriverDataSource extends SimpleDriverDataSource implements Configurable, Closeable
Commons DBCP basic pooling driver data source. The commons-dbcp packages must be on the class path for this plugin to work, as it WILL NOT fall back to non-DBCP mode if they are missing. For automatic usage of Commons DBCP when available, use AutoDriverDataSource instead.
  • Field Details

  • Constructor Details

    • DBCPDriverDataSource

      public DBCPDriverDataSource()
  • Method Details

    • getConnection

      public Connection getConnection(Properties props) throws SQLException
      Overrides:
      getConnection in class SimpleDriverDataSource
      Throws:
      SQLException
    • close

      public void close() throws SQLException
      Specified by:
      close in interface Closeable
      Throws:
      SQLException
    • getDBCPConnection

      protected Connection getDBCPConnection(Properties props) throws SQLException
      Throws:
      SQLException
    • getDBCPDataSource

      protected DataSource getDBCPDataSource(Properties props)
    • isDBCPDataSource

      protected boolean isDBCPDataSource()
      This method should not throw an exception, as it is called by AutoDriverDataSource to determine if user already specified to use Commons DBCP.
      Returns:
      true if ConnectionDriverName contains org.apache.commons.dbcp2, otherwise false
    • isDBCPLoaded

      protected static boolean isDBCPLoaded(ClassLoader cl)
      This method should not throw an exception, as it is called by AutoDriverDataSource to determine if it should use DBCP or not based on if org.apache.commons.dbcp2.BasicDataSource can be loaded.
      Returns:
      true if Commons DBCP was found on the classpath, otherwise false
    • setConfiguration

      public void setConfiguration(Configuration conf)
      Description copied from interface: Configurable
      Invoked prior to setting bean properties.
      Specified by:
      setConfiguration in interface Configurable
    • startConfiguration

      public void startConfiguration()
      Description copied from interface: Configurable
      Invoked before bean property configuration is begun on this object.
      Specified by:
      startConfiguration in interface Configurable
    • endConfiguration

      public void endConfiguration()
      Description copied from interface: Configurable
      Invoked upon completion of bean property configuration for this object.
      Specified by:
      endConfiguration in interface Configurable