Java Code Examples for org.springframework.jdbc.datasource.ConnectionProxy

Following code examples demonstrate how to use org.springframework.jdbc.datasource.ConnectionProxyfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.jdbc.datasource.ConnectionProxyand various code implementation of this class.

	public Connection getNativeConnection(Connection con) throws SQLException {
		Connection conToUse = con;
		while (conToUse instanceof ConnectionProxy) {
			conToUse = ((ConnectionProxy) conToUse).getTargetConnection();
		}
		return doGetNativeConnection(conToUse);
	} 


Advertisement
Javadoc
Subinterface of java.sql.Connection to be implemented by Connection proxies. Allows access to the un

derlying target Connection.

This interface can be checked when there is a need to cast to a native JDBC Connection such as Oracle's OracleConnection. Alternatively, all such connections also support JDBC 4.0's Connection#unwrap. @author Juergen Hoeller @since 1.1 @see TransactionAwareDataSourceProxy @see LazyConnectionDataSourceProxy @see DataSourceUtils#getTargetConnection(java.sql.Connection)

Read More
Advertisement