[cx-oracle-users] RuntimeError: Unable to acquire Oracle environment handle
Brought to you by:
atuining
From: M. A. W. <maw...@gm...> - 2006-10-16 07:41:33
|
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 |