django.db.utils.InterfaceError:('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) )

Viewed 5863

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

I compared my settings in the ODBC data source to my old laptop and it looks the same ,

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

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

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'
          }}
2 Answers

Instead of

'DRIVER': '{ODBC Driver 17 for SQL Server}',

use

'DRIVER': 'SQL Server Native Client 11.0',
Related