【问题标题】:Connecting to Oracle Database with cx_oracle gives DPI-1047 on Windows使用 cx_oracle 连接到 Oracle 数据库会在 Windows 上提供 DPI-1047
【发布时间】:2018-08-25 14:34:39
【问题描述】:
import pandas as pd
import sqlalchemy

engine = sqlalchemy.create_engine('oracle://XXX:XXX@XXX:XXX/?service_name=XXX')

sql = 'select * from XXX where rownum < 10'
df = pd.read_sql(sql,con=engine)

DatabaseError: (cx_Oracle.DatabaseError) DPI-1047: 64 位 Oracle 客户端库无法加载:“C:\oracle\11.2.0\bin\oci.dll is not 正确的架构”。见 https://oracle.github.io/odpi/doc/installation.html#windows求帮助

我正在尝试使用 Python 连接到 Oracle 数据库,但收到上述错误。我知道:

  1. 我已经设置了查看正确位置的路径 - 它显示在错误中。
  2. Python 是 64 位的。
  3. bin 文件夹位置包含 32 位 (ociw32.dll) 和 64 位 (oci.dll) 文件。

但错误仍然告诉我架构是错误的。

对此的任何帮助都会很棒 - 我无法弄清楚问题可能出在哪里!

【问题讨论】:

    标签: python oracle oracle11g python-3.6 cx-oracle


    【解决方案1】:

    错误消息中提到的文件是 32 位 DLL,而不是 64 位 DLL——至少假设检查这些东西的逻辑是正确的!该代码使用此处提到的 imagehelp API:How can I test a Windows DLL file to determine if it is 32 bit or 64 bit?。还有其他几种方法可以验证 DLL 是 32 位还是 64 位。检查您的 PATH 并确保 64 位 Oracle 客户端安装首先在 PATH 中。下载并解压缩 64 位 Oracle Instant Client,以便快速轻松地进行测试。

    【讨论】:

      猜你喜欢
      • 2020-11-23
      • 1970-01-01
      • 2021-01-02
      • 1970-01-01
      • 2020-02-06
      • 2020-08-10
      • 2019-12-06
      • 2022-01-06
      • 2019-02-02
      相关资源
      最近更新 更多