java.lang.Objectorg.springframework.jdbc.datasource.DelegatingDataSource
org.springframework.jdbc.datasource.UserCredentialsDataSourceAdapter
All Implemented Interfaces:
DataSource, InitializingBean
Direct Known Subclasses:
IsolationLevelDataSourceAdapter, WebSphereDataSourceAdapter
getConnection() call, implicitly
invoking getConnection(username, password) on the target.
All other methods simply delegate to the corresponding methods of the
target DataSource.
Can be used to proxy a target JNDI DataSource that does not have user
credentials configured. Client code can work with this DataSource as usual,
using the standard getConnection() call.
In the following example, client code can simply transparently work with the preconfigured "myDataSource", implicitly accessing "myTargetDataSource" with the specified user credentials.
<bean id="myTargetDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:comp/env/jdbc/myds"/> </bean> <bean id="myDataSource" class="org.springframework.jdbc.datasource.UserCredentialsDataSourceAdapter"> <property name="targetDataSource" ref="myTargetDataSource"/> <property name="username" value="myusername"/> <property name="password" value="mypassword"/> </bean>
If the "username" is empty, this proxy will simply delegate to the
standard getConnection() method of the target DataSource.
This can be used to keep a UserCredentialsDataSourceAdapter bean definition
just for the option of implicitly passing in user credentials if
the particular target DataSource requires it.
Juergen - Hoeller1.0.2 - | Method from org.springframework.jdbc.datasource.UserCredentialsDataSourceAdapter Summary: |
|---|
| doGetConnection, getConnection, getConnection, removeCredentialsFromCurrentThread, setCredentialsForCurrentThread, setPassword, setUsername |
| Methods from org.springframework.jdbc.datasource.DelegatingDataSource: |
|---|
| afterPropertiesSet, getConnection, getConnection, getLogWriter, getLoginTimeout, getTargetDataSource, isWrapperFor, setLogWriter, setLoginTimeout, setTargetDataSource, unwrap |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.springframework.jdbc.datasource.UserCredentialsDataSourceAdapter Detail: |
|---|
getConnection(username, password)
method of the target DataSource, passing in the specified user credentials.
If the specified username is empty, it will simply delegate to the standard
getConnection() method of the target DataSource. |
Delegates to #doGetConnection(String, String) with the determined credentials as parameters. |
|
|
getConnection() calls on this DataSource proxy.
This will override any statically specified user credentials, that is, values of the "username" and "password" bean properties. |
Default is no specific password. Note that an explicitly specified username will always override any username/password specified at the DataSource level. |
Default is no specific user. Note that an explicitly specified username will always override any username/password specified at the DataSource level. |