2

This is the error I am getting when I run the django web server.

django.db.utils.OperationalError: (com_error(-2147352567, 'Exception occurred.', (0, u'Microsoft OLE DB Provider for SQL
 Server', u'Invalid connection string attribute', None, 0, -2147217843), None), u'Error opening connection: DATA SOURCE=
server1;Initial Catalog=Misc;UID=DOMAIN\\dcullen;PWD=******;PROVIDER=SQLOLEDB;MARS Connection=True')

settings.py

...
DATABASES = {
    'default': {
        'NAME': 'Misc',
        'ENGINE': 'sqlserver_ado',
        'HOST': 'server1',
        'USER': 'DOMAIN\\dcullen',
        'PASSWORD': 'PWD',
        'OPTIONS': {
            'provider': 'SQLOLEDB',
            'use_legacy_date_fields': 'True'
        }
    }
}
...

connection-strings.com seems to indicate that the driver is not for SQL Server 2012 but SQL Server 2000.

Python version: 2.7 Django version: 1.7.11 django-mssql version: 1.7

Package homepage: https://bitbucket.org/Manfre/django-mssql/

Danny Cullen
  • 1,782
  • 5
  • 30
  • 47

2 Answers2

1

I found the answer now, I was using the wrong provider.

Changing to Provider=SQLNCLI11 solved the issue.

Danny Cullen
  • 1,782
  • 5
  • 30
  • 47
0

try these settings. 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
            }
    }
}
alexander.polomodov
  • 5,396
  • 14
  • 39
  • 46
Dheeraj Inampudi
  • 1,227
  • 15
  • 11