Hi,
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:
Py_NewInterpreter
execute Python script
Py_EndInterpreter
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.
Regards,
Philip Payne
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:
Py_NewInterpreter
execute Python script
Py_EndInterpreter
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.
Regards,
Philip Payne