2
votes

I try to connect my local SQL Serer 2008 with Django. When I try to run the django server then this error is shown:

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

My connection string is:

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': '',
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': '',
        'OPTIONS': {
            'driver': 'ODBC Driver 11 for SQL Server',
        },
    }
}
2
Show us your ODBC setup.Klaus D.
Welcome to Stack Overflow! Please read Why not upload images of code on SO when asking a question?. Please see my edit.help-info.de

2 Answers

0
votes

run pip install django-pyodbc-azure it will install latest 2.1.0.0 version

and in your setting.py

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'name_of_database',
        'HOST': 'your_host',
        'USER': 'database_username',
        'PASSWORD': 'your password',

        'OPTIONS': {
            'driver': 'ODBC Driver 13 for SQL Server',
                   }
    },
}
0
votes

I solved this problem by changing the driver

'driver': 'ODBC Driver 13 for SQL Server' 

to

'driver': 'SQL Server Native Client 11.0'