与Pyodbc的Python-Oracle连接问题

时间:2012-09-24 22:19:42

标签: python oracle odbc pyodbc

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

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()

它一直给我这个错误信息:

  

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

所以我想知道罪魁祸首是否我没有“匹配”组件。目前,我有:

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

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

1 个答案:

答案 0 :(得分:1)

您遇到的问题是64位Windows无法与32位ODBC配合使用。你可以在这里阅读更多相关信息:

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驱动程序。

备注,试图在混合架构平台上为oracle实现ODBC成为我们头疼的问题。因此,我们通过CX_Oracle

实现了对oracle的访问
相关问题