使用pyodbc导致错误:找不到数据源名称,并且未指定默认驱动程序 [英] Using pyodbc cause error: Data source name not found and no default driver specified
本文介绍了使用pyodbc导致错误:找不到数据源名称,并且未指定默认驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用pyodbc连接SQL Server.我创建了这样的连接字符串:
I'm using pyodbc to connect SQL Server. I had created connection string like this:
from sqlalchemy import Table, Column, databases, Integer, String, ForeignKey, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import session
engine = create_engine('mssql+pyodbc://sa:123@localhost/TrainQuizDB')
engine.connect()
TrainQuizDB是我在Sql Server中创建的数据库名称.
TrainQuizDB is database name that I created in Sql Server.
有关更多信息,我具有Windows 8.1 64bit,并且安装了python版本3.5.1 32bit,并且我从 http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyodbc (pyodbc-3.0.10-cp35-none-win32.whl). 但是当我尝试连接它时,会导致此错误:
For more information I have windows 8.1 64bit and I installed python version 3.5.1 32bit and I downloaded pyodbc from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyodbc (pyodbc-3.0.10-cp35-none-win32.whl). But when I try to connect it cause this error:
sqlalchemy.exc.DBAPIError: (pyodbc.Error) ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
我也已经测试了ODBC数据源中的连接,并且连接成功.
Also I have tested the connection In ODBC Data sources and it was successful.
推荐答案
查看全文