[Django]-Error connecting Django 2.0 with sql server 2014 using python 3.6

8👍

✅

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

As the time of writing, django-mssql supports up to version 1.8 of django.

Use django-pyodbc-azure instead of django-mssql

The settings that worked for me:

DATABASES = {
    'default': {
        'NAME': 'DjangoTutorial',
        'ENGINE': 'sql_server.pyodbc',
        'HOST': 'localhost',
        'USER': 'whateveryouuser',
        'PASSWORD': 'whateveryouuser',
        'PORT': '',
        'OPTIONS': {
            'driver': 'SQL Server Native Client 11.0',
        },
    }
}

0👍

This configuration works only with Django 1.8. Hope this helps.

DATABASES = {
'default': {
    'ENGINE': 'sqlserver_ado',
    'NAME': '',
    'USER': '',
    'PASSWORD': '',
    'HOST': '',
    'PORT': '1433',
     'OPTIONS': {
        'provider': 'SQLOLEDB', #SQLNCLI11 , SQLOLEDB
        'use_legacy_date_fields': 'True',
        #'extra_params' : 'DataTypeCompatibility=80;MARS Connection=True',
        #'connect_timeout': 0
        }
}
}

Leave a comment