On Sep 8, 2004, at 3:04 AM, Bart Lateur wrote:
Is there anything foreseen to disconnect a DBI connection, in a mod_perl
(2) setup with Apache::DBI, in case nothing has been requested in
several minutes time? Do the connections stay open forever, or does the
database timeout all by itself? (I suspect it does, anyway)
As Michael said, it all depends on the database, and Sybase never times out. There may be a way some configuration on the database side that you can do.
The only thing I see in Apache::DBI related to timeouts is ping, to check if a connection is still up. That's the opposite of what I'm after. I want to close a connection to MS Access via DBD::ODBC, on my local Windows XP machine, if I've stopped using it for several minutes.
You have the classic push vs. pull problem. If you're running under Apache, your code is waiting for a request and won't trigger unless a request is made. Furthermore, even if you make a request to Apache to run code that will close the connect, you won't know which process you're hitting and you'll certainly leave open connects that you'd want closed.
The way this should be dealt with is with the number of apache clients: StartServers 1 MinSpareServers 1 MaxSpareServers 3
This will guarantee that at most you'll have 3 connects open when the thing is idle, most probably 2 or even 1. The downside is that under heavily changing apache load, you'll be forking and killing lots of processes.
What's the database's timeout, for that setup, anyway?
No idea. Take a look at the MS Access docs and see if it has a timeout setup.
H