[Tutor] cx_Oracle help

Eric Brunson brunson at brunson.com
Tue Feb 5 17:07:51 CET 2008


Greg Lindstrom wrote:
> Hello,
>
> I'm trying to help out a friend and am stumped.  Can you help me out?
> Thanks,
> --greg
>

Hi Greg,

I fought with this for a long, long time when I was trying to get 
cx_Oracle to work with the latest Oracle Instant Client (which I like to 
call "Oracle Instant Crap") on Solaris 10.  It was a while ago and it I 
tried a lot of things, but I think it ended up getting fixed when I 
properly set my $TNS_ADMIN variable so it could find my tnsnames.ora 
file, since it's in a non-standard location wrt $ORACLE_HOME in the 
Instant Crap.

If that doesn't do it, I afraid I don't know what else to suggest.  My 
pertinent oracle environment settings look like this:

LD_LIBRARY_PATH=/usr/local/lib:/usr/sfw/lib:/opt/sfw/lib:/lib:/usr/lib:/usr/local/oracle:/usr/local/ssl/lib:/usr/local/mysql/lib/mysql:/wb/lib/oracle
ORACLE_HOME=/usr/lib/oracle
ORACLE_SID=PROD_ORA01
TNS_ADMIN=/usr/lib/oracle

Note: tnsnames.ora lives in /usr/lib/oracle on my system, TNS_ADMIN just 
refers to the directory.

Hope that helps,
e.

> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
>      I will briefly explain the problem I am facing.
>      I am using Oracle 9.2, Python 2.5 and I installed 
> cx_Oracle-4.3.1-win32-9i-py25 in Python.
>  
>      From python I tried following :
>      >>> import cx_Oracle
>      >>> myDsn = cx_Oracle.makedsn('ISCN47',1521,'AUBDBS01')
>      >>> CONN = cx_Oracle.connect(myusr, mypwd, myDsn)
>                     Traceback (most recent call last):
>                     File "<pyshell#4>", line 1, in <module>
>                    conn = cx_Oracle.Connection('scott','tiger',myDsn)
>                    RuntimeError: Unable to acquire Oracle environment 
> handle
>
>      I have set the below environment variables too
>           NLS_LANG:              <snip>.WE8MSWIN1252
>           ORACLE_HOME:        D:\Tools\oracle\ora92
>           ORACLE_SID:           AUBDBS01
>           PYTHON_HOME:        d:\Utility\Python25
>           PYTHONPATH:         
> %PYTHON_HOME%\lib;%PYTHON_HOME%\DLLs;%PYTHON_HOME%\Lib\site-packages;%ORACLE_HOME%\bin
>           LD_LIBRARY_PATH:   %LD_LIBRARY_PATH%;D:\Tools\oracle\ora92\lib
>  
>      Not getting any idea where I am wrong?
>  
> Regards,
>
> Kishore
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>   



More information about the Tutor mailing list