设置 Cx_Oracle
我正在运行...
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
使用Python版本2.7.1
我安装了Oracle 10g的32位版本的cx_Oracle,但是
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.
当我尝试导入时我得到了。
我检查过,我的 %ORACLE_HOME%
环境变量设置为安装 Oracle 客户端的目录。
我能想到的唯一问题是,为 Oracle 10g 制作的 cx_Oracle 指的是客户端是 10g(我的是 9)而不是数据库(我的数据库是 10g)...或者 cx_Oracle 模块是“32位”是指我的远程数据库是32位而不是我的本地计算机。我尝试了一些不同的版本,但没有成功。
谢谢。
编辑:
另外,我被告知 Oracle 9 应该与 cx_Oracle 的某些版本一起使用..但是哪些版本?我找不到这样的可用版本。这里有什么解决办法吗?
编辑:
我已在本地计算机上更新到 instantclient 10.2。但是现在,我可以很好地导入 cx_Oracle,但是当我尝试建立连接时,我得到以下信息:
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 Oracle 客户端应与 cx_Oracle 版本匹配。使用 Oracle 9 客户端有什么理由吗?您应该能够下载并安装版本 10(甚至 11 客户端)以及匹配的 cx_Oracle 版本。它们都将与 Oracle 10g 一起使用。
我们工作中使用Oracle 10g,我使用11g客户端(以及对应的cx_Oracle版本)。
编辑:我在这里找到了一些旧版本的cx_Oracle:http:// sourceforge.net/projects/cx-oracle/files/
...但是对于 Oracle 9 客户端,您可能需要旧版本的 Python (2.6)。
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.