Expiring Database Connections

drs drs at remove-to-send-mail-ecpsoftware.com
Tue Oct 26 09:31:14 CEST 2004


"Tim Roberts" <timr at probo.com> wrote in message
news:kkorn0lsvp56i4vsvbm8e6drnln27trada at 4ax.com...
> 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.

Perhaps you could create a middle tier between the web and db to hold and or
pool the db connections.  This way, you don't need to worry about which web
processes continue to run, you can share the connection object among them so
you don't have to close it at all, and you'll have a bit more control.

-drs





More information about the Python-list mailing list