Python连接Oracle时的报错

在使用Python的cx_Oracle模块连接Oracle时遇到错误,问题根源在于Oracle Instant Client的版本不匹配。通过升级到64位的instantclient并更新环境变量,成功解决了oci.dll架构错误的问题。
摘要由CSDN通过智能技术生成

@[Python]

Python连接Oracle时的报错

今天在研究使用Python连接Oracle,找到了对应的范例文章:pyhton安装之cx_Oracle模块

参考步骤完成后在CSDN上用了别人的范例代码后跑不通,报错如下:

DatabaseError                             Traceback (most recent call last)
<ipython-input-5-c45d4d670d66> in <module>
      1 import cx_Oracle
      2 dir(cx_Oracle)
----> 3 conn = cx_Oracle.connect('myusername/mypassworld@10.111.1111.11:1521/SERVERNAME')   #用自己的实际数据库用户名、密码、主机ip地址 替换即可
      4 curs=conn.cursor()
      5 sql="select * from ncas037.mars_text_import2 where agcode like '1100078__'" #sql语句

DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "D:\app\ncas041\product\11.2.0\client_1\bin\oci.dll is not the correct architecture". See https://oracle.github.io/odpi/doc/installation.html#windows for help

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值