public class DriverDataSource extends Object implements DataSource
| Modifier and Type | Field and Description |
|---|---|
protected String |
connectionUrl |
protected Driver |
driver |
protected JdbcEventLogger |
logger |
protected String |
password |
protected String |
userName |
| Constructor and Description |
|---|
DriverDataSource(Driver driver,
String connectionUrl,
String userName,
String password)
Creates a new DriverDataSource wrapping a given Driver.
|
DriverDataSource(String driverClassName,
String connectionUrl)
Creates a new DriverDataSource.
|
DriverDataSource(String driverClassName,
String connectionUrl,
String userName,
String password)
Creates a new DriverDataSource.
|
| Modifier and Type | Method and Description |
|---|---|
Connection |
getConnection()
Returns a new database connection, using preconfigured data to locate the database
and obtain a connection.
|
Connection |
getConnection(String userName,
String password)
Returns a new database connection using provided credentials to login to the
database.
|
String |
getConnectionUrl() |
String |
getDriverClassName() |
JdbcEventLogger |
getLogger() |
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
Logger |
getParentLogger() |
String |
getPassword() |
String |
getUserName() |
boolean |
isWrapperFor(Class<?> iface) |
void |
setConnectionUrl(String connectionUrl) |
void |
setDriverClassName(String driverClassName) |
void |
setLogger(JdbcEventLogger delegate) |
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(PrintWriter out) |
void |
setPassword(String password) |
void |
setUserName(String userName) |
<T> T |
unwrap(Class<T> iface) |
protected Driver driver
protected String connectionUrl
protected String userName
protected String password
protected JdbcEventLogger logger
public DriverDataSource(String driverClassName, String connectionUrl) throws SQLException
SQLExceptionpublic DriverDataSource(String driverClassName, String connectionUrl, String userName, String password) throws SQLException
SQLExceptionpublic DriverDataSource(Driver driver, String connectionUrl, String userName, String password)
public Connection getConnection() throws SQLException
getConnection in interface DataSourceSQLExceptionpublic Connection getConnection(String userName, String password) throws SQLException
getConnection in interface DataSourceSQLExceptionpublic int getLoginTimeout()
throws SQLException
getLoginTimeout in interface CommonDataSourceSQLExceptionpublic void setLoginTimeout(int seconds)
throws SQLException
setLoginTimeout in interface CommonDataSourceSQLExceptionpublic PrintWriter getLogWriter() throws SQLException
getLogWriter in interface CommonDataSourceSQLExceptionpublic void setLogWriter(PrintWriter out) throws SQLException
setLogWriter in interface CommonDataSourceSQLExceptionpublic JdbcEventLogger getLogger()
public void setLogger(JdbcEventLogger delegate)
public String getConnectionUrl()
public void setConnectionUrl(String connectionUrl)
public String getPassword()
public void setPassword(String password)
public String getUserName()
public void setUserName(String userName)
public String getDriverClassName()
public void setDriverClassName(String driverClassName) throws SQLException
SQLExceptionpublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor in interface WrapperSQLExceptionpublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap in interface WrapperSQLExceptionpublic Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger in interface CommonDataSourceSQLFeatureNotSupportedExceptionCopyright © 2001–2018 Apache Cayenne. All rights reserved.