RE: [Zope] Zope/Linux/Oracle - Cannot establish DB connection
OK, that looks like it.
When I stopped ZServer (which was originally started by init on boot) and restarted it from a logon (which would have run /etc/profile where all the Oracle environment variables were initialised), I was able to connect.
It looks like I need to set these ORACLE_ environment variables in my startup scripts. Is it a good idea to do this in /etc/rc.d/init.d/zope, or would you recommend doing it somewhere else?
Hi Andrew - There are 2 common ways to define environment variables for the Zope process (and they should be better documented in the standard Zope docs - I think they are just mentioned in the READMEs for the various database adapters right now). Starting with Zope 2.x, most folks use the "start" script generated by the Zope installation to crank up Zope - that's the best place to set any environment variables needed by Zope products (such as DB adapters, though other components could conceivably want env. vars as well). The default "start" script should look something like: #! /bin/sh reldir=`dirname $0` PYTHONHOME=`cd $reldir; pwd` export PYTHONHOME exec /usr/local/bin/python1.5.2 -O \ $PYTHONHOME/z2.py \ -D -P 8000 "$@" So if you add the appropriate env. vars to this, a la: #! /bin/sh reldir=`dirname $0` PYTHONHOME=`cd $reldir; pwd` export PYTHONHOME ORACLE_HOME=/foo/bar export ORACLE_HOME ORACLE_SID=whatever_it_is export ORACLE_SID exec /usr/local/bin/python1.5.2 -O \ $PYTHONHOME/z2.py \ -D -P 8000 "$@" Then the Zope process will get them, provided you start Zope with the "start" script (via init.d, manually or some other means). Another way to do it is to put the appropriate variables in your Zope.cgi file, but *this only works if you use PCGI exclusively and PCGI is responsible for starting up your Zope process*. This is mainly a holdover from 1.x, where in most cases pcgi was responsible for starting the process. That is rarely the case now, but I wanted to mention it in case this tidbit is useful to somebody. If (and only if) PCGI starts the process itself, any name=value pairs found in the pcgi resource file (Zope.cgi) that don't relate directly to PCGI are added to the environment at the time that PCGI starts the Zope process. Hope this helps! Brian Lloyd brian@digicool.com Software Engineer 540.371.6909 Digital Creations http://www.digicool.com
participants (1)
-
Brian Lloyd