org.apache.cayenne.conn
Class DriverDataSource

java.lang.Object
  extended by org.apache.cayenne.conn.DriverDataSource
All Implemented Interfaces:
javax.sql.DataSource

public class DriverDataSource
extends java.lang.Object
implements javax.sql.DataSource

A DataSource implementation wrapping a JDBC driver.

Author:
Andrei Adamchik

Field Summary
protected  java.lang.String connectionUrl
           
protected  java.sql.Driver driver
           
protected  ConnectionEventLoggingDelegate 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.
 
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.
 ConnectionEventLoggingDelegate getLogger()
           
 int getLoginTimeout()
           
 java.io.PrintWriter getLogWriter()
           
 void setLogger(ConnectionEventLoggingDelegate delegate)
           
 void setLoginTimeout(int seconds)
           
 void setLogWriter(java.io.PrintWriter out)
           
 
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 ConnectionEventLoggingDelegate logger
Constructor Detail

DriverDataSource

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

Throws:
java.sql.SQLException

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.

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 ConnectionEventLoggingDelegate getLogger()

setLogger

public void setLogger(ConnectionEventLoggingDelegate delegate)


Copyright © 2001-2006 Apache.org All Rights Reserved.