org.springframework.jdbc.datasource |
Provides a utility class for easy DataSource access,
a PlatformTransactionManager for a single DataSource,
and various simple DataSource implementations.
|
Java Source File Name | Type | Comment |
AbstractDataSource.java | Class | Abstract base class for Spring's DataSource implementations,
taking care of the padding. |
ConnectionHandle.java | Interface | Simple interface to be implemented by handles for a JDBC Connection. |
ConnectionHolder.java | Class | Connection holder, wrapping a JDBC Connection. |
ConnectionProxy.java | Interface | Subinterface of
java.sql.Connection to be implemented by
Connection proxies. |
DataSourceTransactionManager.java | Class | org.springframework.transaction.PlatformTransactionManager implementation for a single JDBC
javax.sql.DataSource . |
DataSourceUtils.java | Class | Helper class that provides static methods for obtaining JDBC Connections from
a
javax.sql.DataSource . |
DelegatingDataSource.java | Class | JDBC
javax.sql.DataSource implementation that delegates all calls
to a given target
javax.sql.DataSource . |
DriverManagerDataSource.java | Class | Simple implementation of the standard JDBC DataSource interface, configuring
a plain old JDBC Driver via bean properties, and returning a new Connection
for every getConnection call.
NOTE: This class is not an actual connection pool; it does not actually
pool Connections. It just serves as simple replacement for a full-blown
connection pool, implementing the same standard interface, but creating new
Connections on every call.
Useful for test or standalone environments outside of a J2EE container, either
as a DataSource bean in a corresponding ApplicationContext or in conjunction with
a simple JNDI environment. |
IsolationLevelDataSourceAdapter.java | Class | An adapter for a target
javax.sql.DataSource , applying the current
Spring transaction's isolation level (and potentially specified user credentials)
to every getConnection call. |
JdbcTransactionObjectSupport.java | Class | Convenient base class for JDBC-aware transaction objects.
Can contain a
ConnectionHolder , and implements the
org.springframework.transaction.SavepointManager interface based on that ConnectionHolder.
Allows for programmatic management of JDBC 3.0
java.sql.Savepoint Savepoints . |
LazyConnectionDataSourceProxy.java | Class | Proxy for a target DataSource, fetching actual JDBC Connections lazily,
i.e. |
SimpleConnectionHandle.java | Class | Simple implementation of the ConnectionHandle interface,
containing a given JDBC Connection. |
SingleConnectionDataSource.java | Class | Implementation of SmartDataSource that wraps a single Connection which is not
closed after use. |
SmartDataSource.java | Interface | Extension of the javax.sql.DataSource interface, to be
implemented by special DataSources that return JDBC Connections
in an unwrapped fashion.
Classes using this interface can query whether or not the Connection
should be closed after an operation. |
TransactionAwareDataSourceProxy.java | Class | Proxy for a target JDBC
javax.sql.DataSource , adding awareness of
Spring-managed transactions. |
UserCredentialsDataSourceAdapter.java | Class | An adapter for a target JDBC
javax.sql.DataSource , applying the specified
user credentials to every standard 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. |
WebSphereDataSourceAdapter.java | Class | DataSource implementation that delegates all calls to a WebSphere
target
DataSource , typically obtained from JNDI, applying a current
isolation level and/or current user credentials to every Connection obtained
from it.
Uses IBM-specific API to get a JDBC Connection with a specific isolation
level (and read-only flag) from a WebSphere DataSource
(IBM code example).
Supports the transaction-specific isolation level exposed by
org.springframework.transaction.support.TransactionSynchronizationManager.getCurrentTransactionIsolationLevel .
It's also possible to specify a default isolation level, to be applied when the
current Spring-managed transaction does not define a specific isolation level.
Usage example, defining the target DataSource as an inner-bean JNDI lookup
(of course, you can link to any WebSphere DataSource through a bean reference):
<bean id="myDataSource" class="org.springframework.jdbc.datasource.WebSphereDataSourceAdapter">
<property name="targetDataSource">
<bean class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/myds"/>
</bean>
</property>
</bean>
Thanks to Ricardo Olivieri for submitting the original implementation
of this approach!
author: Juergen Hoeller author: Lari Hotari author: Ricardo N. |