0

我在这里是相对初学者级别的python开发人员。我只是无法从 pypyodbc 连接到 Oracle

import pypyodbc as pyodbc
connstr = 'DSN = IDW;PWD=XXXXX'
connection = pyodbc.connect(connstr)

错误如下:

File "C:\Users\PRXM\Desktop\JobReadings\PythonIDE\eclipse-standard-luna-R-win32-x86_64\eclipse\plugins\org.python.pydev_4.1.0.201505270003\pysrc\pydevd.py", line 1709, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
File "C:\Users\PRXM\workspace\tests\gettingstarted.py", line 10, in <module>
    connection = pyodbc.connect(connstr)
File "C:\Users\PRXM\Desktop\JobReadings\PythonIDE\Anaconda_64\lib\site-packages\pypyodbc.py", line 2434, in __init__
    self.connect(connectString, autocommit, ansi, timeout, unicode_results, readonly)
File "C:\Users\PRXM\Desktop\JobReadings\PythonIDE\Anaconda_64\lib\site-packages\pypyodbc.py", line 2483, in connect
    check_success(self, ret)
File "C:\Users\PRXM\Desktop\JobReadings\PythonIDE\Anaconda_64\lib\site-packages\pypyodbc.py", line 988, in check_success
    ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi)
File "C:\Users\PRXM\Desktop\JobReadings\PythonIDE\Anaconda_64\lib\site-packages\pypyodbc.py", line 964, in ctrl_err
    raise Error(state,err_text)
pypyodbc.Error: (u'IM002', u'[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified')
4

1 回答 1

2

尝试这个:

Connection_String = 'Driver={Oracle in OraClient11g_home1};DBQ=MyDB;Uid=MyUser;Pwd=MyPassword;'
于 2015-08-13T02:52:55.353 回答