【问题标题】:cx_Oracle.DatabaseError: DPI-1047cx_Oracle.DatabaseError: DPI-1047
【发布时间】:2019-01-22 15:46:11
【问题描述】:

我正在尝试运行代码以在 oracle 数据库中创建表。我正在使用 Python 3.6.5Oracle Database 10g Express Edition Release 10.2。 0.1.0 在 Windows 64 位中。

con=cx_Oracle.connect(config.connection)

cx_Oracle.DatabaseError:DPI-1047:无法加载 64 位 Oracle 客户端库:“C:\oracleexe\app\oracle\product\10.2.0\server\bin\oci.dll 不是正确的架构” .

【问题讨论】:

    标签: python oracle


    【解决方案1】:

    您似乎无法连接到 Oracle 数据库。正如here指出的那样:

    您需要为python安装cx_Oracle扩展并确保环境变量设置正确

    另外,请查看config.connection 中的凭据是否正确。

    【讨论】:

      【解决方案2】:

      cx_Oracle 6+ 需要使用 Oracle 11.2+ 库。看来您正在将它与您的 10g 数据库库链接。您可以使用免费的Oracle Instant Client 安装 11.2 库,设置 PATH 以包含它们,然后连接到您的 10g 数据库 - 但不要为需要 10g 库的其他应用程序填充 PATH。您可能需要使用 BAT 脚本之类的东西来设置 PATH,然后调用 python。

      Oracle 11.2 库必须是与 Python 相同的 32 位或 64 位。

      如果https://cx-oracle.readthedocs.io/en/latest/installation.html 中有任何不清楚的地方,请在https://github.com/oracle/python-cx_Oracle/issues 的 cx_Oracle 项目中记录问题

      【讨论】:

        猜你喜欢
        • 2021-08-15
        • 2019-02-02
        • 2019-10-19
        • 2020-08-20
        • 2020-05-21
        • 2021-11-08
        • 2019-01-06
        • 2021-06-25
        • 2017-12-26
        相关资源
        最近更新 更多