Using Sql Server with Django 2.0 Using Sql Server with Django 2.0 django django

Using Sql Server with Django 2.0


Found the solution and post it if anyone facing same problem.

I used django-pyodbc-azure 2.0.4.1 in my Django 2.0.4

The settings that worked for me:

DATABASES = {    'default': {        'ENGINE': 'sql_server.pyodbc',        'NAME': 'dbName',        'USER': 'yourUserName',        'PASSWORD': 'yourPassword',        'HOST': '(local)',        'PORT': '',        'OPTIONS': {            'driver': 'ODBC Driver 11 for SQL Server',        },    }}


I was facing same error of ODBC Driver Manager

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

Solution: When i added below code in database connection, then my error fixed.
'OPTIONS': { 'host_is_server': True, 'driver': 'ODBC Driver 11 for SQL Server', }