Expiring Database Connections

Tim Roberts timr at probo.com
Tue Oct 26 07:42:13 CEST 2004


This question is only marginally related to Python, but I'm going to ask it
here because (a) this is the most tolerant group in the comp.lang
hierarchy, and (b) people in this group would know the answer.

Many of the Python-based web solutions use a long-running process: WebWare,
FastCGI, and mod_python all run an interpreter long-term, and keep the
classes loaded until the web server stops.

On Windows, with some databases, this represents a problem.  With Access
specifically, and with SQLite occasionally, having an open database
connection can make it impossible to open the database from another
process, such as from a command line.  It seems to me that I could solve
this problem by starting up a deadman timer when a database connection is
opened, and if no additional connections are made in, say, one or two
minutes, close the database connection completely.

I'm wondering if anyone has done such a thing and/or has any thoughts or
comments.  My web searches were unsuccessful.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list