Subject Re: Tomcat + DBCP + FireBird
Author solusinfo_lms
hello!

I have still the same problem (using BasicDataSource still because
already used in my application) but I try to 'occupy' application to
make a test : I made a thread which questions database every minute
and I log results (I know, it isn't the best solution!).

first test : I use my application. thread is OK but I can't get a
connection after 30 min of inactivity when I try to re use my
application.
second test : I don't use my application any all. thread is OK
(durign 928 min!!!) but when I try my application in browser, I can't
get a connection!

I don't understand why I arrive to get connection in my thread (on
the pool too) but not in application after a time of inactivity!

Have you any idea ? Thanks

-------------------------------------------------------------------

I wrote :

>Hi,
>I try to use Firebird 1.5 (NT4 Server) from Tomcat 4.1.30 (Debian
>server) with DBCP, JayBird 1.5 RC3 (using a BasicDatasourceFactory).
>If I use my web app, it works well but when i stop using it for a
>few time, when i want to use it again, connection seems to be lost
>and Throws a FBSQLExcetpion 'cannot read data from the connection',
>and then i only can restart Tomcat to go on working.
>I do not know what to do, so, please help me!!
>Thanks
>michel


--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy"

<rrokytskyy@a...> wrote:
>
> > I think you have 2 way to resolve this problem:
> > 1) Catch this exception and, if needed, get a new connection from
the
> > datasource
> > 2) (The best solution and the most adopted) Get a connection for
each
> > transaction/set of queries, make your queries and close the
connection
> > at the end.
>
> I suspect that the reason is different. Pool keeps connections open
> for "infinite" period of time (unless idle timeout is specified, but
> let's forget it for now). However, it seems that your server is
> configured to drop open socket if no activity is happening during
XXX
> seconds (this is network configuration of the operating system, not
> Firebird). After that pool still believes that connection is open
> (because it did not close it), however socket is no longer valid.
Pool
> returns connection to the application, but the application cannot do
> anything with it, returns it back. Connection is still believed to
be
> valid. This will happen until the pool is restarted.
>
> You have to check if DBCP provides a possibility to validate a
> connection before returning it to the application. JayBird 1.5 pool
> implementation has so called "pingStatement" and "pingInterval" -
> simple "SELECT CAST(1 as INTEGER) FROM rdb$database" is executed
each
> "pingInterval" seconds. There must be something similar in DBCP too.
>
> Roman