win10 新环境 使用anaconda 的cx_Oracle链接服务器上的oracle数据库:
异常详情:
cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help
初步处理:
已经下载并在系统变量中设置好 instantclient_12_2,仍然提示上述异常。
解决过程:
思路1:配置信息不正确:
主要配置内容:
1、系统环境变量path:
path变量中添加instantclient_12_2文件位置:D:\Software\instantclient_12_2
2、添加系统变量TNS_ADMIN:
TNS_ADMIN
D:\Software\instantclient_12_2
代码测试是否可以连接服务器中的数据库。
测试结果:测试失败,显示错误仍然显示上述问题。
思路2:下载的包版本不匹配:
重新下载11_2的client包:Instant Client for Microsoft Windows (x64) 64-bit (oracle.com)
【方便使用,上传至csdn,可以直接获取。】:
instantclient_11_2.rar-Oracle文档类资源-CSDN文库
在系统path中配置文件路径之后,重新测试。
测试结果:连接成功。
参考链接: