[英]django.db.utils.InterfaceError:('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) )
I have a Django web app with azure sql server,i move the code from one laptop to another and suddenly i got django.db.utils.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)') imidatly after starting the web server I have a Django web app with azure sql server,i move the code from one laptop to another and suddenly i got django.db.utils.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data启动 web 服务器后,未找到源名称且未指定默认驱动程序 (0) (SQLDriverConnect)')
I have been able to isolate the problem, and realized it coming from the db connection in setting.py, i tried to run simple python quay from the console and it worked我已经能够隔离问题,并意识到它来自setting.py中的数据库连接,我尝试从控制台运行简单的python quay并且它有效
I compared my settings in the ODBC data source to my old laptop and it looks the same,我将 ODBC 数据源中的设置与我的旧笔记本电脑进行了比较,看起来一样,
SOLVED-- i noticed that only diffrence was that in my old laptop i have also ODBC Driver 13 for SQL Server, i installed this as well and it worked已解决——我注意到唯一的区别是在我的旧笔记本电脑中我还有 SQL 服务器的 ODBC 驱动程序 13,我也安装了它并且它工作
I am using: Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32我正在使用:Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.输入“帮助”、“版权”、“信用”或“许可”以获取更多信息。 Any ideas?
有任何想法吗?
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'XXXXXX',
'Trusted_Connection':'No',
'HOST' : 'XXXXXXXXXXX',
'DRIVER': '{ODBC Driver 17 for SQL Server}',
'OPTIONS': {
'extra_params': 'APP=Setting.py',
},
'AUTOCOMMIT' : True ,
'USER' : 'XXXXXXX',
'PASSWORD' : 'XXXXXXX'
}}
I needed to install https://www.microsoft.com/en-us/download/details.aspx?id=56567 odbc my SQL 17 driver.我需要安装https://www.microsoft.com/en-us/download/details.aspx?id=56567 odbc 我的 Z9778840A0100CB30C982Z17 驱动程序。
Instead of代替
'DRIVER': '{ODBC Driver 17 for SQL Server}',
use利用
'DRIVER': 'SQL Server Native Client 11.0',
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.