| java.lang.Object org.springframework.jdbc.datasource.DataSourceUtils
Method Summary | |
public static void | applyTimeout(Statement stmt, DataSource dataSource, int timeout) Apply the specified timeout - overridden by the current transaction timeout,
if any - to the given JDBC Statement object. | public static void | applyTransactionTimeout(Statement stmt, DataSource dataSource) Apply the current transaction timeout, if any,
to the given JDBC Statement object. | public static Connection | doGetConnection(DataSource dataSource) Actually obtain a JDBC Connection from the given DataSource.
Same as
DataSourceUtils.getConnection , but throwing the original SQLException.
Is aware of a corresponding Connection bound to the current thread, for example
when using
DataSourceTransactionManager . | public static void | doReleaseConnection(Connection con, DataSource dataSource) Actually close the given Connection, obtained from the given DataSource. | public static Connection | getConnection(DataSource dataSource) Obtain a Connection from the given DataSource. | public static Connection | getTargetConnection(Connection con) Return the innermost target Connection of the given Connection. | public static boolean | isConnectionTransactional(Connection con, DataSource dataSource) Determine whether the given JDBC Connection is transactional, that is,
bound to the current thread by Spring's transaction facilities. | public static Integer | prepareConnectionForTransaction(Connection con, TransactionDefinition definition) Prepare the given Connection with the given transaction semantics. | public static void | releaseConnection(Connection con, DataSource dataSource) Close the given Connection, obtained from the given DataSource,
if it is not managed externally (that is, not bound to the thread). | public static void | resetConnectionAfterTransaction(Connection con, Integer previousIsolationLevel) Reset the given Connection after a transaction,
regarding read-only flag and isolation level. |
CONNECTION_SYNCHRONIZATION_ORDER | final public static int CONNECTION_SYNCHRONIZATION_ORDER(Code) | | Order value for TransactionSynchronization objects that clean up
JDBC Connections.
|
applyTimeout | public static void applyTimeout(Statement stmt, DataSource dataSource, int timeout) throws SQLException(Code) | | Apply the specified timeout - overridden by the current transaction timeout,
if any - to the given JDBC Statement object.
Parameters: stmt - the JDBC Statement object Parameters: dataSource - the DataSource that the Connection was obtained from Parameters: timeout - the timeout to apply (or 0 for no timeout outside of a transaction) throws: SQLException - if thrown by JDBC methods See Also: java.sql.Statement.setQueryTimeout |
applyTransactionTimeout | public static void applyTransactionTimeout(Statement stmt, DataSource dataSource) throws SQLException(Code) | | Apply the current transaction timeout, if any,
to the given JDBC Statement object.
Parameters: stmt - the JDBC Statement object Parameters: dataSource - the DataSource that the Connection was obtained from throws: SQLException - if thrown by JDBC methods See Also: java.sql.Statement.setQueryTimeout |
getTargetConnection | public static Connection getTargetConnection(Connection con)(Code) | | Return the innermost target Connection of the given Connection. If the given
Connection is a proxy, it will be unwrapped until a non-proxy Connection is
found. Else, the passed-in Connection will be returned as-is.
Parameters: con - the Connection proxy to unwrap the innermost target Connection, or the passed-in one if no proxy See Also: ConnectionProxy.getTargetConnection |
isConnectionTransactional | public static boolean isConnectionTransactional(Connection con, DataSource dataSource)(Code) | | Determine whether the given JDBC Connection is transactional, that is,
bound to the current thread by Spring's transaction facilities.
Parameters: con - the Connection to check Parameters: dataSource - the DataSource that the Connection was obtained from(may be null ) whether the Connection is transactional |
releaseConnection | public static void releaseConnection(Connection con, DataSource dataSource)(Code) | | Close the given Connection, obtained from the given DataSource,
if it is not managed externally (that is, not bound to the thread).
Parameters: con - the Connection to close if necessary(if this is null , the call will be ignored) Parameters: dataSource - the DataSource that the Connection was obtained from(may be null ) See Also: DataSourceUtils.getConnection |
resetConnectionAfterTransaction | public static void resetConnectionAfterTransaction(Connection con, Integer previousIsolationLevel)(Code) | | Reset the given Connection after a transaction,
regarding read-only flag and isolation level.
Parameters: con - the Connection to reset Parameters: previousIsolationLevel - the isolation level to restore, if any See Also: DataSourceUtils.prepareConnectionForTransaction |
|
|