Subject | Re: [Firebird-Java] Re: FBResourceException |
---|---|
Author | Juan Pedro López Sáez |
Post date | 2003-08-25T15:07:12Z |
Hello all,
Some weeks ago I was in troubles with a FBResourceException (see the
full mail list thread for details).
I think I have found a solution.
Using DBPC for connection pooling, the easiest way to drop connections
form the pool when they can't be used any longer is adding the following
lines to the Tomcat's server.xml file (when configuring the
BasicDataSource)
<parameter>
<name>validationQuery</name>
<value>select expression</value>
</parameter>
Doing this, when an application calls javax.DataSource.getConnection()
to get a connection from the pool, the select expression stated in the
new configuration line is automaticaly executed for the connection to be
returned. If this SQL statement throws a result set with at least one
record, the connection is returned to the method's caller. On the other
hand, if the select fails the connection is dropped from the pool and
there is an attempt to fetch a new one. If this fails, the method throws
an exception.
Using the built-in pooling mechanism, FBWrappingDataSource seems to drop
connections from the pool after a fatal error happens.
Best regards,
Juan Pedro Lopez
--
Juan Pedro López Sáez
ALTIRIA TIC, S.L.L.
www.altiria.com
Some weeks ago I was in troubles with a FBResourceException (see the
full mail list thread for details).
I think I have found a solution.
Using DBPC for connection pooling, the easiest way to drop connections
form the pool when they can't be used any longer is adding the following
lines to the Tomcat's server.xml file (when configuring the
BasicDataSource)
<parameter>
<name>validationQuery</name>
<value>select expression</value>
</parameter>
Doing this, when an application calls javax.DataSource.getConnection()
to get a connection from the pool, the select expression stated in the
new configuration line is automaticaly executed for the connection to be
returned. If this SQL statement throws a result set with at least one
record, the connection is returned to the method's caller. On the other
hand, if the select fails the connection is dropped from the pool and
there is an attempt to fetch a new one. If this fails, the method throws
an exception.
Using the built-in pooling mechanism, FBWrappingDataSource seems to drop
connections from the pool after a fatal error happens.
Best regards,
Juan Pedro Lopez
--
Juan Pedro López Sáez
ALTIRIA TIC, S.L.L.
www.altiria.com