org.apache.commons.dbcp2

## Class DataSourceConnectionFactory

- java.lang.Object
- - org.apache.commons.dbcp2.DataSourceConnectionFactory

- All Implemented Interfaces:
    ConnectionFactory

      public class DataSourceConnectionFactory
      extends Object
      implements ConnectionFactory

  A `DataSource`-based implementation of `ConnectionFactory`.
  Since:
    2.0
  Version:
    $Revision: 1572242 $ $Date: 2014-02-26 20:34:39 +0000 (Wed, 26 Feb 2014) $
  Author:
    Rodney Waldhoff

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DataSourceConnectionFactory(DataSource source)`
    `DataSourceConnectionFactory(DataSource source, String uname, String passwd)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Connection` | `createConnection()` Create a new `Connection` in an implementation specific fashion.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DataSourceConnectionFactory

          public DataSourceConnectionFactory(DataSource source)

    - #### DataSourceConnectionFactory

          public DataSourceConnectionFactory(DataSource source,
                                     String uname,
                                     String passwd)

  - ### Method Detail

    - #### createConnection

          public Connection createConnection()
                                      throws SQLException

      Description copied from interface: `ConnectionFactory`
      Create a new `Connection` in an implementation specific fashion.
      Specified by:
        `createConnection` in interface `ConnectionFactory`
      Returns:
        a new `Connection`
      Throws:
        `SQLException` - if a database error occurs creating the connection

Copyright © 2001–2014 The Apache Software Foundation. All rights reserved.