Unable to acquire Oracle environment handle

Environment: Eclipse Indigo or Eclipse Juno 4.2 on Windows 7. Oracle 11g XE (local install) When running my Django project in pydev, attempted page access results in the message "Unable to acquire Oracle environment handle".

Normally, all I have to do is set TNS_ADMIN to point to the correct tnsnames.ora directory.

If I run manage.py from the command line, all works as expected. I thought at first that it was probably an environment variable difference, but the TNS_ADMIN values are the same. In any case, explicitly setting TNS_ADMIN in the Eclipse run configuration didn't make a difference.

PYTHONPATH was somewhat different between the two, and I went to the trouble of overriding it in the run config to see if it made the difference. Nope.

Looking at the cx_Oracle source, the error seems to come from a failure in a call to OCIEnvNlsCreate, but I didn't see anything obvious in the Oracle documentation.

Can anyone give me a clue why I'm getting this in Pydev?

Answers


I figured it out. I didn't look hard enough at the PATH variable.

Basically, there was a virtual environment that needed its scripts directory (containing OCI.DLL) to be first in the path, but my Oracle installation was ahead of it. So, the error message was basically the result of calling the wrong OCI.DLL (the one associated with my Oracle installation, rather than the one cx_Oracle was bound to).

Activating the virtual environment worked because it changed the path. Pydev works differently, so Eclipse was seeing my standard path with the Oracle install first.


Need Your Help

WordPress XMLRPC: Expat reports error code 5

php blogs xml-rpc

I wrote a small PHP application several months ago that uses the WordPress XMLRPC library to synchronize two separate WordPress blogs. I have a general "RPCRequest" function that packages the requ...

can collection select batch size be defined SessionFactory-wide in Hibernate 4?

hibernate

Hibernate's @BatchSize can be used to define select batch size behavior for annotated collections (or types). However, is there a way to configure SessionFactory to set a global select batch size f...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.