You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Meikel Bisping <M....@gmx.de> on 2005/01/26 14:01:49 UTC
[DBCP] request for improved Exception nesting in ConnectionPool
Hi,
I tried to establish a ConnectionPool with DBCP to an Informix
Database using your examples.
I always got the exeception "pool exhausted" when trying to open the
first connection.
I eventually found out during debugging that the problem was an older
Informix driver (that is generally still in use, though).
It didn't support read-only mode and threw an SQLException even when
calling setReadOnly(false).
It would be helpful for users if in cases like that the actual
exception would be thrown, "pool exhausted" didn't help much.
Cheers,
Meikel Bisping
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [DBCP] request for improved Exception nesting in ConnectionPool
Posted by Dirk Verbeeck <di...@pandora.be>.
Good suggestion. The underlying exception was already visible in the
stacktrace but the message can be improved.
How about using the following catch block in the connect method.
} 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.getMessage(), e);
}
-- Dirk
Meikel Bisping wrote:
> Hi,
>
> I tried to establish a ConnectionPool with DBCP to an Informix
> Database using your examples.
> I always got the exeception "pool exhausted" when trying to open the
> first connection.
> I eventually found out during debugging that the problem was an older
> Informix driver (that is generally still in use, though).
> It didn't support read-only mode and threw an SQLException even when
> calling setReadOnly(false).
> It would be helpful for users if in cases like that the actual
> exception would be thrown, "pool exhausted" didn't help much.
>
> Cheers,
>
> Meikel Bisping
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org