Python 连接oracle 报错 :oci.dll is not the correct architecture 解决方案

完整错误:DPI-1047: 64-bit Oracle Client library cannot be loaded: "D:\app\xyg\product\11.2.0\client_1\bin\oci.dll is not the correct architecture"

原因:

        instantclient版本为32位,需更换成64位。

解决方案:

1. 重新下载 instantclient 64位, 下载链接:http://jvniu.jb51.net:81/201708/tools/instantclientx64_jb51.rar

下载完成后,解压得到 文件夹 instantclient_11_2

2   将整个文件夹移动到oracle安装目录,client子文件夹内

3.  添加环境变量(下图为win10系统)

4.   重启python, 成功连接oracle。

 

5.我在使用python连接oracle12.2.2的时候,报以下错误: 
cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor 
译为: 
cx_Oracle.DatabaseError: ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务

最后我发现连接python连接cx_oracle时,要用SERVICE_NAME,而不是sid,至于原因,我再查查~~~ 
首先,在用管理员账号登陆oracle,查询SERVICE_NAME:

select value from v$parameter where name like '%service_name%';
  • 1

这里写图片描述 
其次,将查询到的service_name替换sid即可 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值