Search in sources :

Example 1 with DelegatingConnection

use of org.apache.commons.dbcp.DelegatingConnection in project pentaho-kettle by pentaho.

the class ConnectionPoolUtilIntegrationIT method testAccessToUnderlyingConnectionAllowedProperty.

@Test
public void testAccessToUnderlyingConnectionAllowedProperty() throws Exception {
    Connection conn = null;
    DatabaseMeta dbMeta = new DatabaseMeta("testAccessToUnderlying", "H2", "JDBC", null, "mem:test", null, "SA", "");
    dbMeta.setConnectionPoolingProperties(dsProps);
    try {
        conn = ConnectionPoolUtil.getConnection(logChannelInterface, dbMeta, "part1", INITIAL_POOL_SIZE, MAX_ACTIVE);
        Connection dconn = ((DelegatingConnection) conn).getInnermostDelegate();
        assertNotNull("Property 'accessToUnderlyingConnectionAllowed' doesn't work", dconn);
    } catch (Exception e) {
        fail();
    }
}
Also used : DelegatingConnection(org.apache.commons.dbcp.DelegatingConnection) Connection(java.sql.Connection) DelegatingConnection(org.apache.commons.dbcp.DelegatingConnection) KettleException(org.pentaho.di.core.exception.KettleException) SQLException(java.sql.SQLException) Test(org.junit.Test)

Aggregations

Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 DelegatingConnection (org.apache.commons.dbcp.DelegatingConnection)1 Test (org.junit.Test)1 KettleException (org.pentaho.di.core.exception.KettleException)1