Python+Apache+Oracle+???Persistent database connection???
ScherBi at BAM.com
ScherBi at BAM.com
Fri Aug 20 21:00:34 CEST 1999
You can acheive persistant database connectivity by converting your cgi apps
to pcgi. pcgi (persistant cgi), was developed by Jeff Bauer, and is
available as a component of Zope (http://www.zope.org). You can use pcgi
with or without Zope.
From: Philip Payne [mailto:pnpayne at swissonline.ch]
Sent: Friday, August 20, 1999 2:50 PM
To: python-list at python.org
Subject: Python+Apache+Oracle+???Persistent database connection???
Can any of you Python gurus tell me if the following would be
easy/possible/impossible and perhaps point me in the right direction???
I have Python (1.5.1), Apache (1.3.6), Oracle (8.0.5), PyApache (4.16),
and DCOracle (Python interface to Oracle - 1.2.1) on my Linux box
(Caldera OpenLinux 2.2). It works fine.
But what I would like to have is a persistent database connection for
each Apache child server that is accessible to every Python script that
is fired up by that server. This because logging on to Oracle is VERY
expensive compared to simple database accesses. As far as I can see this
isn't possible with PyApache/DCOracle at present.
Now my Python level is middling, I have no experience in embedding or
extending Python, or in writing Apache modules, and my C is *VERY*
rusty, but from browsing some of the documentation and code this is my
limited understanding of what happens every time when Apache calls
PyApache to run a Python script:
execute Python script
Logging on to Oracle in DCOracle returns a 'Connection' object. Am I
right in thinking that this object and every other Python object
automatically and ineluctably get destroyed by the Py_EndInterpreter
call??? If yes, is there any way to save it away 'somewhere' and get it
back later 'somehow' after the next Py_NewInterpreter call??? Or would
this require some sort of coordination between the PyApache and DCOracle
code??? Or is it impossible???
Any help gratefully appreciated.
More information about the Python-list