|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jdbc.datasource.AbstractDataSource org.springframework.jdbc.datasource.AbstractDriverBasedDataSource
public abstract class AbstractDriverBasedDataSource
Abstract base class for JDBC DataSource
implementations
that operate on a JDBC Driver
.
SimpleDriverDataSource
,
DriverManagerDataSource
Field Summary |
---|
Fields inherited from class org.springframework.jdbc.datasource.AbstractDataSource |
---|
logger |
Constructor Summary | |
---|---|
AbstractDriverBasedDataSource()
|
Method Summary | |
---|---|
Connection |
getConnection()
This implementation delegates to getConnectionFromDriver ,
using the default username and password of this DataSource. |
Connection |
getConnection(String username,
String password)
This implementation delegates to getConnectionFromDriver ,
using the given username and password. |
protected abstract Connection |
getConnectionFromDriver(Properties props)
Obtain a Connection using the given properties. |
protected Connection |
getConnectionFromDriver(String username,
String password)
Build properties for the Driver, including the given username and password (if any), and obtain a corresponding Connection. |
Properties |
getConnectionProperties()
Return the connection properties to be passed to the Driver, if any. |
String |
getPassword()
Return the JDBC password to use for connecting through the Driver. |
String |
getUrl()
Return the JDBC URL to use for connecting through the Driver. |
String |
getUsername()
Return the JDBC username to use for connecting through the Driver. |
void |
setConnectionProperties(Properties connectionProperties)
Specify arbitrary connection properties as key/value pairs, to be passed to the Driver. |
void |
setPassword(String password)
Set the JDBC password to use for connecting through the Driver. |
void |
setUrl(String url)
Set the JDBC URL to use for connecting through the Driver. |
void |
setUsername(String username)
Set the JDBC username to use for connecting through the Driver. |
Methods inherited from class org.springframework.jdbc.datasource.AbstractDataSource |
---|
getLoginTimeout, getLogWriter, isWrapperFor, setLoginTimeout, setLogWriter, unwrap |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractDriverBasedDataSource()
Method Detail |
---|
public void setUrl(String url)
Driver.connect(String, java.util.Properties)
public String getUrl()
public void setUsername(String username)
Driver.connect(String, java.util.Properties)
public String getUsername()
public void setPassword(String password)
Driver.connect(String, java.util.Properties)
public String getPassword()
public void setConnectionProperties(Properties connectionProperties)
Can also contain "user" and "password" properties. However, any "username" and "password" bean properties specified on this DataSource will override the corresponding connection properties.
Driver.connect(String, java.util.Properties)
public Properties getConnectionProperties()
public Connection getConnection() throws SQLException
getConnectionFromDriver
,
using the default username and password of this DataSource.
SQLException
getConnectionFromDriver(String, String)
,
setUsername(java.lang.String)
,
setPassword(java.lang.String)
public Connection getConnection(String username, String password) throws SQLException
getConnectionFromDriver
,
using the given username and password.
SQLException
getConnectionFromDriver(String, String)
protected Connection getConnectionFromDriver(String username, String password) throws SQLException
username
- the name of the userpassword
- the password to use
SQLException
- in case of failureDriver.connect(String, java.util.Properties)
protected abstract Connection getConnectionFromDriver(Properties props) throws SQLException
Template method to be implemented by subclasses.
props
- the merged connection properties
SQLException
- in case of failure
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |