Pyodbc的Python-Oracle连接问题 [英] Python-Oracle connection issue with Pyodbc

查看:613
本文介绍了Pyodbc的Python-Oracle连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图使用Pyodbc连接到Oracle数据库:

Tried to connect to the Oracle database using Pyodbc:

try:
    db_connection = pyodbc.connect('DSN=OraDev; PWD=%s' % Key.dbKeys['password'])
except pyodbc.Error, err:
        print >> debug_file, "Database connection failed: %s" %err 
        sys.exit()

,它一直给我这个错误消息:

and it keeps giving me this error message:

'[IM014] [Microsoft] [ODBC驱动程序管理器]指定的DSN 包含驱动程序和应用程序之间的体系结构不匹配 (0)(SQLDriverConnect)

'[IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application (0) (SQLDriverConnect)

所以我想知道罪魁祸首是否是我没有匹配"的组件.目前,我有:

So I am wondering if the culprit is that I am not having the "matching" components. Currently, I have:

  1. Python 2.7 32位
  2. Pyodbc 3.0.6 win32-py2.7
  3. Oracle ODBC驱动程序:32位
  4. Windows Server 2008 64位
  5. Oracle 11.2.0 64位
  1. Python 2.7 32bit
  2. Pyodbc 3.0.6 win32-py2.7
  3. Oracle ODBC driver: 32bit
  4. Windows server 2008 64bit
  5. Oracle 11.2.0 64bit

这里的版本有什么问题吗?谢谢.

Are there anything wrong with the versions here? Thanks.

推荐答案

您遇到的问题是64位Windows在32位ODBC上不能很好地发挥作用.您可以在此处了解更多信息:

The issue you are having is that 64 bit Windows does not play well with 32 bit ODBC. You can read more about it here:

显示32位版本的ODBC管理器工具和64位版本的ODBC管理器Windows操作系统的64位版本中的32位用户DSN和64位用户DSN.

The 32-bit version of the ODBC Administrator tool and the 64-bit version of the ODBC Administrator tool display both the 32-bit user DSNs and the 64-bit user DSNs in a 64-bit version of the Windows operating system.

解决方法是将ODBC驱动程序专门针对要实现的体系结构.

The work around is to specifically target the ODBC driver for the architecture you are looking to implement.

一个旁注,尝试在混合体系结构平台上为oracle实现ODBC成为我们的头疼.因此,我们通过 CX_Oracle

A side note, trying to implement ODBC for oracle on a mixed architecture platform became a headache for us. So, we implemented access to oracle through CX_Oracle

这篇关于Pyodbc的Python-Oracle连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆