简体   繁体   English

使用cx_Oracle从Python连接到Oracle时出错

[英]Error when connecting to Oracle from Python using cx_Oracle

I'm attempting to connect to an Oracle db using python 3.6.3 and the above mentioned cx_oracle installation. 我正在尝试使用python 3.6.3和上面提到的cx_oracle安装连接到Oracle数据库。 It's definitely finding the client and the mentioned vc redistributable as far as I can tell, because I had different errors when I first tried to run it. 据我所知,它确实找到了客户端和提到的vc可再发行组件,因为当我第一次尝试运行它时,我遇到了不同的错误。 Now I'm getting: 现在我得到:

cx_Oracle.DatabaseError: DPI-1050: Oracle Client library must be at version 11.2 or higher

Now I'm not really an Oracle guy, so maybe I'm misreading or misunderstanding something. 现在我不是一个真正的甲骨文家伙,所以也许我误读或误解了一些东西。 InstantClient 12.2 is the required client, correct? InstantClient 12.2是必需的客户端,对吗? And according to the docs cx_oracle 6 is compatible with 11.2, 12.1 and 12.2, so where did I go wrong? 根据文档,cx_oracle 6与11.2,12.1和12.2兼容,那么我哪里出错?


edit: 编辑:

  • ORACLE_HOME was not set, so I added it, pointed at the InstantClient installation, but it made no difference. ORACLE_HOME没有设置,所以我添加它,指向InstantClient安装,但它没有任何区别。
  • cx_oracle.clientversion() throws the same error as mentioned above. cx_oracle.clientversion()抛出与上面提到的相同的错误。
  • For clarity: This is Windows Server 2012 R2 为清楚起见:这是Windows Server 2012 R2

I had this same problem. 我有同样的问题。 Make sure you have the oci.dll in your path, but rename it to oci_11_2.dll 确保路径中有oci.dll ,但将其重命名为oci_11_2.dll

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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