是什么导致pypyodbc显示此错误

时间:2018-10-19 15:58:30

标签: python python-3.x teradata pyodbc pypyodbc

我正在尝试将我的脚本从pyodbc切换到pypyodbc。我有以下连接字符串:

cnxn = pyodbc.connect('DSN=Teradata ODBC DSN;DATABASE=*******;UID=******;PWD=******')

与pyodbc完美配合,但是当我改为使用pypyodbc时,出现以下错误:

  File "web.py", line 8, in <module>
    cnxn = pyodbc.connect('DSN=Teradata ODBC DSN')
  File "/usr/local/lib/python3.5/dist-packages/pypyodbc.py", line 2437, in __init__
    AllocateEnv()
  File "/usr/local/lib/python3.5/dist-packages/pypyodbc.py", line 1017, in AllocateEnv
    check_success(SQL_NULL_HANDLE, ret)
  File "/usr/local/lib/python3.5/dist-packages/pypyodbc.py", line 1011, in check_success
    ctrl_err(SQL_HANDLE_ENV, ODBC_obj, ret, False)
  File "/usr/local/lib/python3.5/dist-packages/pypyodbc.py", line 991, in ctrl_err
    raise ProgrammingError('', 'SQL_INVALID_HANDLE')
pypyodbc.ProgrammingError: ('', 'SQL_INVALID_HANDLE')

什么可能导致这种情况发生?我已经看到了一些修复程序,这些修复程序涉及从连接字符串中删除不必要的引号,但是我不相信这里有任何引号,因此我不确定还有其他事情要做。

0 个答案:

没有答案