Nir Elbaz
Nir Elbaz

Reputation: 616

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

Upvotes: 7

Views: 10686

Answers (3)

Ioan Stoianov
Ioan Stoianov

Reputation: 135

You need to install the correct version of the OBDC Driver

https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-ver16

Upvotes: 0

Vishu
Vishu

Reputation: 21

Instead of

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

use

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

Upvotes: 2

David Louda
David Louda

Reputation: 577

I needed to install https://www.microsoft.com/en-us/download/details.aspx?id=56567 odbc my SQL 17 driver.

Upvotes: 3

Related Questions