简体   繁体   中英

Setting up Cx_Oracle

I am running ...

SQL*Plus: Release 9.2.X.X.X - Production on Wed Jun 22 13:02:14 2011

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.X.X.X - 64bit Production
With the Partitioning, OLAP and Data Mining options

with Python version 2.7.1

I installed the 32 bit version of cx_Oracle for Oracle 10g but I get

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    import cx_Oracle
ImportError: DLL load failed: The specified procedure could not be found.

when I try to import.

I checked and my %ORACLE_HOME% Env Variable is set to the directory where my Oracle client is installed.

The only problem(s) I can think of is that the cx_Oracle being made for Oracle 10g refers to the client being 10g (where mine is 9) instead of the database (my database is 10g)... or that the cx_Oracle module being "32bit" is refering to my remote database being 32bit instead of my local machine. I've done a little playing around with different versions to no avail.

Thanks.

EDIT:

Also, I'm told that Oracle 9 should work with some versions of cx_Oracle.. but which ones? I can't find such a version available. Is there any work arounds here?

Edit:

I've updated to instantclient 10.2 on my local machine. Now, however, I can import cx_Oracle just fine but when I try to make a connection I get the following:

Traceback (most recent call last):
  File "C:\oracleTest.py", line 2, in <module>
    connection = cx_Oracle.connect("username/password@(DESCRIPTION STRING)")
DatabaseError: ORA-12705: Cannot access NLS data files or invalid environment specified

Your Oracle client should match the cx_Oracle version. Any reason for using the Oracle 9 client? You should be able to just download and install the version 10 (or even 11 client), and matching cx_Oracle version. They will both work with Oracle 10g.

We use Oracle 10g at work, and I use the 11g client (and corresponding cx_Oracle version).

EDIT: I found some older versions of cx_Oracle here: http://sourceforge.net/projects/cx-oracle/files/

...but you may need an older version of Python (2.6) for the ones that are for the Oracle 9 client.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM