if you intend to use mysql you could send down for instance "select 1" to
the database..
but this is not database independent since not all databases might be albe
to handle this type of query
but it is application independent when using mysql.
if you plan to use an other database some other form of sql query might be
needed  and now it might
also be application dependant..

the other way to do it is to assume that after a while a connection will die
and create a new connection

every timeyou make an query to the database you store the timefor the
connection (last used time)
and every time you get a connection from the pool the time is checked
against a timeout, if the
current time - last used time is larger then the timeout, "close"  the
connection and make a new connection

since I can find no standard "keep alive" system in jdbc (I'm using java) or
sql/database I myself had to go for
this last sollution..

hope it helps!

/Christian Andersson

----- Original Message -----
From: "Sylvain Hamel" <[EMAIL PROTECTED]>
To: "MySQL Mailing list" <[EMAIL PROTECTED]>
Sent: Friday, November 09, 2001 3:50 PM
Subject: Connection timeout and pooling


> IDE : JBuilder 4 prof
>
> I am using pooling in order to optimize database access. When everybody
> leaves the office for the weekend all my connection timeout. This is
> expected except I would like my connection pool to be able to test
> connections before passing them back to the requester. Whats the best way
to
> do this? Cant say I like sending a (context dependent) query to the
database
> because it makes my class not re-usable across applications.



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to