Package org.apache.tomcat.dbcp.dbcp2

## Class DriverManagerConnectionFactory

- java.lang.Object
- - org.apache.tomcat.dbcp.dbcp2.DriverManagerConnectionFactory

All Implemented Interfaces:
  `ConnectionFactory`

    public class DriverManagerConnectionFactory
    extends java.lang.Object
    implements ConnectionFactory

A `DriverManager`-based implementation of `ConnectionFactory`.

Since:
  2.0

### Constructor Summary

Constructors
`DriverManagerConnectionFactory​(java.lang.String connectionUri)` Constructor for DriverManagerConnectionFactory.
`DriverManagerConnectionFactory​(java.lang.String connectionUri, java.lang.String userName, char[] userPassword)` Constructor for DriverManagerConnectionFactory.
`DriverManagerConnectionFactory​(java.lang.String connectionUri, java.lang.String userName, java.lang.String userPassword)` Constructor for DriverManagerConnectionFactory.
`DriverManagerConnectionFactory​(java.lang.String connectionUri, java.util.Properties properties)` Constructor for DriverManagerConnectionFactory.

### Method Summary

All Methods Instance Methods Concrete Methods
`java.sql.Connection` `createConnection()` Create a new `Connection` in an implementation specific fashion.
`java.lang.String` `getConnectionUri()`
`java.util.Properties` `getProperties()`
`java.lang.String` `getUserName()`

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

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

### Constructor Detail

#### DriverManagerConnectionFactory

    public DriverManagerConnectionFactory​(java.lang.String connectionUri)

Constructor for DriverManagerConnectionFactory.

Parameters:
  `connectionUri` - a database connection string of the form `jdbc:<em>subprotocol</em>:<em>subname</em>`
Since:
  2.2

#### DriverManagerConnectionFactory

    public DriverManagerConnectionFactory​(java.lang.String connectionUri,
                                          java.util.Properties properties)

Constructor for DriverManagerConnectionFactory.

Parameters:
  `connectionUri` - a database connection string of the form `jdbc:<em>subprotocol</em>:<em>subname</em>`
  `properties` - a list of arbitrary string tag/value pairs as connection arguments; normally at least a "user" and "password" property should be included.

#### DriverManagerConnectionFactory

    public DriverManagerConnectionFactory​(java.lang.String connectionUri,
                                          java.lang.String userName,
                                          char[] userPassword)

Constructor for DriverManagerConnectionFactory.

Parameters:
  `connectionUri` - a database connection string of the form `jdbc:<em>subprotocol</em>:<em>subname</em>`
  `userName` - the database user
  `userPassword` - the user's password

#### DriverManagerConnectionFactory

    public DriverManagerConnectionFactory​(java.lang.String connectionUri,
                                          java.lang.String userName,
                                          java.lang.String userPassword)

Constructor for DriverManagerConnectionFactory.

Parameters:
  `connectionUri` - a database connection string of the form `jdbc:<em>subprotocol</em>:<em>subname</em>`
  `userName` - the database user
  `userPassword` - the user's password

### Method Detail

#### createConnection

    public java.sql.Connection createConnection()
                                         throws java.sql.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:
  `java.sql.SQLException` - if a database error occurs creating the connection

#### getConnectionUri

    public java.lang.String getConnectionUri()

Returns:
  The connection URI.
Since:
  2.6.0

#### getProperties

    public java.util.Properties getProperties()

Returns:
  The Properties.
Since:
  2.6.0

#### getUserName

    public java.lang.String getUserName()

Returns:
  The user name.
Since:
  2.6.0