【问题标题】:cx_oracle 6 for Oracle 12C version errorcx_oracle 6 for Oracle 12C 版本错误
【发布时间】:2018-06-11 15:38:30
【问题描述】:

我正在尝试使用 oracle 12c 作为我使用 Django 框架的应用程序的数据库。但我对版本相关问题感到震惊

以下是使用的库版本:

  • Python 3.6
  • cx_Oracle 6
  • Oracle 即时客户端 12.2
  • 服务器上的 Oracle 12 C 数据库
  • cx_oracle 所在的本地计算机上的 Oracle 10 g 已安装

操作系统是 windows 7

以下是我安装 cx_oracle 的步骤

  1. pip install cx_Oracle
  2. 下载适用于 Windows 的 Oracle Instant Client 12.2 zip 文件
  3. 解压压缩文件
  4. 将上述解压后的文件夹添加到用户 PATH 变量中

从 CMD 我尝试执行

python 
import cx_Oracle 
con = cx_Oracle.connect(uname, pwd, server_ip:port/name)

我收到错误:

cx_oracle.databaseerror: dpi-1050: oracle 客户端库必须是 11.2 或更高版本

cx_Oracle 是否与本地机器上安装的 oracle 10g 有任何冲突 我无法升级本地 oracle 10g db,因为(未授予权限)

如何解决上述问题。 如何确保 cx_Oracle 使用正确的 Oracle 即时客户端(即 12.2)连接到服务器数据库。

【问题讨论】:

    标签: django oracle python-3.x oracle12c cx-oracle


    【解决方案1】:

    你也使用 set ORACLE_HOME:

    SET ORACLE_HOME=C:\Oracle\client_12_1
    SET PATH=C:\Oracle\client_12_1\bin;%PATH%
    python 
    import cx_Oracle 
    con = cx_Oracle.connect(uname, pwd, server_ip:port/name)
    

    【讨论】:

    • 使用即时客户端时不要设置ORACLE_HOME!
    【解决方案2】:

    确保包含即时客户端的目录在 PATH 环境变量中早于您的 10g 安装。那应该会为您解决。

    【讨论】:

      猜你喜欢
      • 2021-08-06
      • 1970-01-01
      • 1970-01-01
      • 2018-10-25
      • 2018-09-10
      • 2018-01-01
      • 1970-01-01
      • 2018-09-12
      • 2017-01-28
      相关资源
      最近更新 更多