public class DriverDataSource extends Object implements DataSource
Modifier and Type | Field and Description |
---|---|
protected String |
connectionUrl |
protected Driver |
driver |
protected String |
password |
protected String |
userName |
Constructor and Description |
---|
DriverDataSource(Driver driver,
String connectionUrl,
String userName,
String password)
Creates a DriverDataSource wrapping a given Driver.
|
DriverDataSource(String driverClassName,
String connectionUrl)
Deprecated.
since 4.0 as class loading should not happen here. Use {
DriverDataSource(Driver, String, String, String) . |
DriverDataSource(String driverClassName,
String connectionUrl,
String userName,
String password)
Deprecated.
since 4.0 as class loading should not happen here. Use
DriverDataSource(Driver, String, String, String) . |
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()
Deprecated.
since 4.0. Connection parameters are immutable and not
readable.
|
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
Logger |
getParentLogger() |
String |
getPassword()
Deprecated.
since 4.0. Connection parameters are immutable and not
readable.
|
String |
getUserName()
Deprecated.
since 4.0. Connection parameters are immutable and not
readable.
|
boolean |
isWrapperFor(Class<?> iface) |
void |
setConnectionUrl(String connectionUrl)
Deprecated.
since 4.0. Connection parameters are immutable.
|
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(PrintWriter out) |
void |
setPassword(String password)
Deprecated.
since 4.0. Connection parameters are immutable.
|
void |
setUserName(String userName)
Deprecated.
since 4.0. Connection parameters are immutable.
|
<T> T |
unwrap(Class<T> iface) |
protected Driver driver
protected String connectionUrl
protected String userName
protected String password
@Deprecated public DriverDataSource(String driverClassName, String connectionUrl)
DriverDataSource(Driver, String, String, String)
.@Deprecated public DriverDataSource(String driverClassName, String connectionUrl, String userName, String password)
DriverDataSource(Driver, String, String, String)
.public DriverDataSource(Driver driver, String connectionUrl, String userName, String password)
public Connection getConnection() throws SQLException
getConnection
in interface DataSource
SQLException
public Connection getConnection(String userName, String password) throws SQLException
getConnection
in interface DataSource
SQLException
public int getLoginTimeout() throws SQLException
getLoginTimeout
in interface CommonDataSource
SQLException
public void setLoginTimeout(int seconds) throws SQLException
setLoginTimeout
in interface CommonDataSource
SQLException
public PrintWriter getLogWriter() throws SQLException
getLogWriter
in interface CommonDataSource
SQLException
public void setLogWriter(PrintWriter out) throws SQLException
setLogWriter
in interface CommonDataSource
SQLException
@Deprecated public String getConnectionUrl()
@Deprecated public void setConnectionUrl(String connectionUrl)
@Deprecated public String getPassword()
@Deprecated public void setPassword(String password)
@Deprecated public String getUserName()
@Deprecated public void setUserName(String userName)
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger
in interface CommonDataSource
SQLFeatureNotSupportedException
Copyright © 2001–2017 Apache Cayenne. All rights reserved.