Package org.apache.cayenne.datasource
Class DriverDataSource
java.lang.Object
org.apache.cayenne.datasource.DriverDataSource
- All Implemented Interfaces:
- Wrapper,- CommonDataSource,- DataSource
public class DriverDataSource extends Object implements DataSource
A non-pooling DataSource implementation wrapping a JDBC driver.
- 
Field Summary
- 
Constructor SummaryConstructors Constructor Description DriverDataSource(Driver driver, String connectionUrl, String userName, String password)Creates a DriverDataSource wrapping a given Driver.
- 
Method SummaryModifier and Type Method Description ConnectiongetConnection()Returns a new database connection, using preconfigured data to locate the database and obtain a connection.ConnectiongetConnection(String userName, String password)Returns a new database connection using provided credentials to login to the database.intgetLoginTimeout()PrintWritergetLogWriter()LoggergetParentLogger()booleanisWrapperFor(Class<?> iface)voidsetLoginTimeout(int seconds)voidsetLogWriter(PrintWriter out)<T> Tunwrap(Class<T> iface)Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.sql.CommonDataSourcecreateShardingKeyBuilderMethods inherited from interface javax.sql.DataSourcecreateConnectionBuilder
- 
Field Details- 
driver
- 
connectionUrl
- 
userName
- 
password
 
- 
- 
Constructor Details- 
DriverDataSourceCreates a 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 Details- 
getConnectionReturns a new database connection, using preconfigured data to locate the database and obtain a connection.- Specified by:
- getConnectionin interface- DataSource
- Throws:
- SQLException
 
- 
getConnectionReturns a new database connection using provided credentials to login to the database.- Specified by:
- getConnectionin interface- DataSource
- Throws:
- SQLException
 
- 
getLoginTimeout- Specified by:
- getLoginTimeoutin interface- CommonDataSource
- Specified by:
- getLoginTimeoutin interface- DataSource
- Throws:
- SQLException
 
- 
setLoginTimeout- Specified by:
- setLoginTimeoutin interface- CommonDataSource
- Specified by:
- setLoginTimeoutin interface- DataSource
- Throws:
- SQLException
 
- 
getLogWriter- Specified by:
- getLogWriterin interface- CommonDataSource
- Specified by:
- getLogWriterin interface- DataSource
- Throws:
- SQLException
 
- 
setLogWriter- Specified by:
- setLogWriterin interface- CommonDataSource
- Specified by:
- setLogWriterin interface- DataSource
- Throws:
- SQLException
 
- 
isWrapperFor- Specified by:
- isWrapperForin interface- Wrapper
- Throws:
- SQLException
- Since:
- 3.0
 
- 
unwrap- Specified by:
- unwrapin interface- Wrapper
- Throws:
- SQLException
- Since:
- 3.0
 
- 
getParentLogger- Specified by:
- getParentLoggerin interface- CommonDataSource
- Throws:
- SQLFeatureNotSupportedException
- Since:
- 3.1
 
 
-