protected PooledConnectionAndInfo getPooledConnectionAndInfo(String username, String password) throws SQLException { synchronized (this) { if (pool == null) { try { registerPool(username, password); } catch (NamingException e) { throw new SQLNestedException("RegisterPool failed", e); } } } PooledConnectionAndInfo info = null; UserPassKey key = new UserPassKey(username, password); try { info = (PooledConnectionAndInfo) pool.borrowObject(key); } catch (Exception e) { throw new SQLNestedException("Could not retrieve connection info from pool", e); } return info; }