You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by manish ramteke <ma...@gmail.com> on 2016/04/15 07:43:16 UTC

DBCP 1.4 : null returned by PoolingDataSource's getConnection()

Hi,

I am using DBCP 1.4, and facing below behavior on high traffic (40-50 tps)
on server despite of sufficient value for max connection pool size 300. I
am using Oracle JDBC Driver 6.

When PoolingDataSource's tries to borrow connection from
GenericObjectPool's borrowObject() method using getConnection(), conn
 returns null.

Please let me know possible causes for this error scenario.

Code snippet :

public Connection getConnection() throws SQLException {
        try {
            Connection conn = (Connection)(_pool.borrowObject());
            if (conn != null) {
                conn = new PoolGuardConnectionWrapper(conn);
            }
            return conn;
        } catch(SQLException e) {
            throw e;
        } catch(NoSuchElementException e) {
            throw new SQLNestedException("Cannot get a connection, pool
error " + e.getMessage(), e);
        } catch(RuntimeException e) {
            throw e;
        } catch(Exception e) {
            throw new SQLNestedException("Cannot get a connection, general
error", e);
        }
    }



Thanks and Regards,
Manish