Subject Re: [Firebird-Java] Re: Tomcat + DBCP + FireBird
Author Roman Rokytskyy
Hi,

> So i want to use "pingInterval" to keep it alive but it doesn't seem
> to work : i look at the network activity (with ethereal from debian
> server that supports tomcat) and nothing happens : no packet
> transmitted to FireBird server. Here are my parameters for JayBird
> pool in server.xml (note, in my java code I get a connection - make
> my queries - close my connection) :

Pool will not send "pings" when connection is in pool. Pool will execute the
"ping" statement when connection that is returned from pool was not used
longer than "pingInterval". When the "ping" statement fails, it will mark
the connection as "broken", close it, remove it from the pool and will try
to fetch the new one.

This feature will not prevent connections from closing, however you should
never obtain a connection that is unusable.

If you do want to keep the connection open while keeping it in the pool, you
have to modify sources of the pool to do this. I think the most easy
approach is to extend the thread that checks the idle timeout and "ping" the
connection there.

BTW, you can ignore the pingStatement parameter, by default it is "SELECT
CAST(1 AS INTEGER) FROM rdb$database", it is guaranteed to succeed if the
connection is working.

Roman