Re: [cx-oracle-users] RuntimeError: Unable to acquire Oracle environment handle
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2006-10-16 14:11:33
|
This is a common issue. The cgi script does __not__ have the same environment as your console/x-term does. Setting the environment variable ORACLE_HOME is thus necessary one way or the other before starting to use the Oracle client. There are a number of other messages to this list that indicate what you did is (one of) the correct solution(s). On 10/16/06, M. A. Wani <maw...@gm...> wrote: > Hi All, > > i am executing python script as cgi, path of this script is in html page > but got error > RuntimeError: Unable to acquire Oracle environment handle > > (i solve this error , but not sure is this proper way) > > funny thing is > i used sqlplus "user/password@connection" > it worked fine > got sql> prompt > > > then i wrote a script file test.py > > import cx_Oracle > db = cx_Oracle.connect("user/password@connection") > cur = db.cursor() > cur.execute("select * from emp") > r = cur.fetchall() > for i in r: > print i > > > it also worked fine, i thought my environment is proper. > > > then i wrote cgi-script > > #!/usr/bin/python > print 'content-type: text/html','\n'; > import cgi > import sys > import cx_Oracle > import os > sys.stderr = sys.stdout > db = cx_Oracle.connect('mukhtar/mukhtar@navi') > > but got error on browser (RuntimeError: Unable to acquire Oracle > environment handle ) > > then explicitly I set ORACLE_HOME in script itself, it worked > > #!/usr/bin/python > print 'content-type: text/html','\n'; > > import cgi > import sys > import cx_Oracle > import os > sys.stderr = sys.stdout > os.putenv('ORACLE_HOME','/u01/app/oracle/product/9.2.0') > # i just add this line, > db = cx_Oracle.connect('mukhtar/mukhtar@navi') > > > but got confused it ORACLE_HOME is set and working with normal script, why > i need to put this line in cgi-script > > Thanks in Advance, > Mukhtar > > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > |