List of usage examples for org.apache.commons.dbcp SQLNestedException getCause
public synchronized Throwable getCause()
From source file:org.smartfrog.services.persistence.framework.connectionpool.ConnectionPoolImpl.java
public Connection getConnection() throws SQLException { /**//www . j a v a 2 s . c om * If the data source is closed throw exception */ if (dataSource == null) { throw new SQLPoolClosedException("Connection pool is closed"); } /** * get the connection * Cannot create PoolableConnectionFactory */ try { return dataSource.getConnection(); } catch (SQLNestedException e) { // TODO: get all the reasons from dbcp documentation Throwable cause = e.getCause(); if (cause instanceof java.util.NoSuchElementException) { throw new SQLPoolTimeoutException("Timeout trying to obtain a connection from the connection pool", e); } else { throw new SQLPoolAccessException("Failure trying to obtain a connection from the connection pool", e); } } catch (SQLException e) { throw new SQLPoolAccessException("Failure trying to obtain a connection from the connection pool", e); } }