pythonsql-serverdjangodjango-mssql

django-mssql - Invalid connection string attribute


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/


Solution

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

    Changing to Provider=SQLNCLI11 solved the issue.