Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.conn
Class DriverDataSource

    java.lang.Object
      org.apache.cayenne.conn.DriverDataSource

All Implemented Interfaces:
  javax.sql.DataSource

    public class DriverDataSource

extends java.lang.Object
implements javax.sql.DataSource

A non-pooling DataSource implementation wrapping a JDBC driver.

Field Summary
`protected java.lang.String` | `connectionUrl`
`protected java.sql.Driver` | `driver`
`protected JdbcEventLogger` | `logger`
`protected java.lang.String` | `password`
`protected java.lang.String` | `userName`

Constructor Summary
`DriverDataSource(java.sql.Driver driver, java.lang.String connectionUrl, java.lang.String userName, java.lang.String password)` Creates a new DriverDataSource wrapping a given Driver.
`DriverDataSource(java.lang.String driverClassName, java.lang.String connectionUrl)` Creates a new DriverDataSource.
`DriverDataSource(java.lang.String driverClassName, java.lang.String connectionUrl, java.lang.String userName, java.lang.String password)` Creates a new DriverDataSource.

Method Summary
`java.sql.Connection` | `getConnection()` Returns a new database connection, using preconfigured data to locate the database and obtain a connection.
`java.sql.Connection` | `getConnection(java.lang.String userName, java.lang.String password)` Returns a new database connection using provided credentials to login to the database.
`java.lang.String` | `getConnectionUrl()`
`java.lang.String` | `getDriverClassName()`
`JdbcEventLogger` | `getLogger()`
`int` | `getLoginTimeout()`
`java.io.PrintWriter` | `getLogWriter()`
`java.lang.String` | `getPassword()`
`java.lang.String` | `getUserName()`
`boolean` | `isWrapperFor(java.lang.Class<?> iface)`
`void` | `setConnectionUrl(java.lang.String connectionUrl)`
`void` | `setDriverClassName(java.lang.String driverClassName)`
`void` | `setLogger(JdbcEventLogger delegate)`
`void` | `setLoginTimeout(int seconds)`
`void` | `setLogWriter(java.io.PrintWriter out)`
`void` | `setPassword(java.lang.String password)`
`void` | `setUserName(java.lang.String userName)`
`
`<T> T`
` | `unwrap(java.lang.Class<T> iface)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### driver

    protected java.sql.Driver driver

### connectionUrl

    protected java.lang.String connectionUrl

### userName

    protected java.lang.String userName

### password

    protected java.lang.String password

### logger

    protected JdbcEventLogger logger

Constructor Detail

### DriverDataSource

    public DriverDataSource(java.lang.String driverClassName,
                            java.lang.String connectionUrl)
                     throws java.sql.SQLException

  Creates a new DriverDataSource. If "driverClassName" is null, DriverDataSource will consult DriverManager for a registered driver for the given URL. So when specifying null, a user must take care of registering the driver. "connectionUrl" on the other hand must NOT be null.

  Throws:
    `java.sql.SQLException`

### DriverDataSource

    public DriverDataSource(java.lang.String driverClassName,
                            java.lang.String connectionUrl,
                            java.lang.String userName,
                            java.lang.String password)
                     throws java.sql.SQLException

  Creates a new DriverDataSource. If "driverClassName" is null, DriverDataSource will consult DriverManager for a registered driver for the given URL. So when specifying null, a user must take care of registering the driver. "connectionUrl" on the other hand must NOT be null.

  Throws:
    `java.sql.SQLException`
  Since:
    3.0

### DriverDataSource

    public DriverDataSource(java.sql.Driver driver,
                            java.lang.String connectionUrl,
                            java.lang.String userName,
                            java.lang.String password)

  Creates a new DriverDataSource wrapping a given Driver. If "driver" is null, DriverDataSource will consult DriverManager for a registered driver for the given URL. So when specifying null, a user must take care of registering the driver. "connectionUrl" on the other hand must NOT be null.

  Since:
    1.1

Method Detail

### getConnection

    public java.sql.Connection getConnection()
                                      throws java.sql.SQLException

  Returns a new database connection, using preconfigured data to locate the database and obtain a connection.

  Specified by:
    `getConnection` in interface `javax.sql.DataSource`
  Throws:
    `java.sql.SQLException`

### getConnection

    public java.sql.Connection getConnection(java.lang.String userName,
                                             java.lang.String password)
                                      throws java.sql.SQLException

  Returns a new database connection using provided credentials to login to the database.

  Specified by:
    `getConnection` in interface `javax.sql.DataSource`
  Throws:
    `java.sql.SQLException`

### getLoginTimeout

    public int getLoginTimeout()
                        throws java.sql.SQLException

  Specified by:
    `getLoginTimeout` in interface `javax.sql.DataSource`
  Throws:
    `java.sql.SQLException`

### setLoginTimeout

    public void setLoginTimeout(int seconds)
                         throws java.sql.SQLException

  Specified by:
    `setLoginTimeout` in interface `javax.sql.DataSource`
  Throws:
    `java.sql.SQLException`

### getLogWriter

    public java.io.PrintWriter getLogWriter()
                                     throws java.sql.SQLException

  Specified by:
    `getLogWriter` in interface `javax.sql.DataSource`
  Throws:
    `java.sql.SQLException`

### setLogWriter

    public void setLogWriter(java.io.PrintWriter out)
                      throws java.sql.SQLException

  Specified by:
    `setLogWriter` in interface `javax.sql.DataSource`
  Throws:
    `java.sql.SQLException`

### getLogger

    public JdbcEventLogger getLogger()

### setLogger

    public void setLogger(JdbcEventLogger delegate)

### getConnectionUrl

    public java.lang.String getConnectionUrl()

  Since:
    3.0

### setConnectionUrl

    public void setConnectionUrl(java.lang.String connectionUrl)

  Since:
    3.0

### getPassword

    public java.lang.String getPassword()

  Since:
    3.0

### setPassword

    public void setPassword(java.lang.String password)

  Since:
    3.0

### getUserName

    public java.lang.String getUserName()

  Since:
    3.0

### setUserName

    public void setUserName(java.lang.String userName)

  Since:
    3.0

### getDriverClassName

    public java.lang.String getDriverClassName()

### setDriverClassName

    public void setDriverClassName(java.lang.String driverClassName)
                            throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### isWrapperFor

    public boolean isWrapperFor(java.lang.Class<?> iface)
                         throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`
  Since:
    3.0

### unwrap

    public <T> T unwrap(java.lang.Class<T> iface)
             throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`
  Since:
    3.0

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.