Establishing a connection with MS SQL Server 2014 with django-mssql-1.6

I know that django-mssql-1.6 / README :

SQL Server Versions

Supported Versions:

  • 2008
  • 2008R2
  • 2012

but, seeing that version 1.6 is the latest version, I wondered if anyone could find a way to connect to MS SQL Server 2014. I try, but I get an error message:

django.db.utils.OperationalError: (com_error (-2147352567, "An exception occurred.", (0, u'ADODB.Connection ", u'Provider could not be found. It may not be installed correctly. ', u'C : \ Windows \ HELP \ ADO270.CHM ', 1240655, -2146824582), None), u'Error open connection: DATA SOURCE = 127.0.0.1; Initial Catalog = testdb; Integrated Security = SSPI; PROVIDER = sqlncli10; DataTypeCompatibility = 80 ; MARS Connection = True ')

using config:

DATABASES = {
    'default': {
        'ENGINE': 'sqlserver_ado',
        'NAME': 'testdb'
    }
}
+4
source share
4 answers

, django-mssql Django. 1,6 1,7 , sql_server.pyodbc django 1.7. django-mssql (sqlserver_ado).   , . Django-mssql SQLCLI10 , . , , , SQLOLEDB. :

    DATABASES = {
    'default': {
        'NAME': 'CVH_Dev',
        'ENGINE': 'sqlserver_ado',
        'HOST': '192.***.212.2**',
        'USER': 'USER',
        'PASSWORD': 'PWD',
        'OPTIONS': {
            'provider': 'SQLOLEDB',
            'use_legacy_date_fields': 'True'
        }
    }
}

SQLOLEDB, . , .

+6

, , ... Django 1.10, django-mssql, django-pyodbc-azure, MS SQL Server 2014 2016 .

, :

  • Windows Server 2012 R2
  • Python 3.5.2
  • SQL Server 2016
  • Django 1.10
+4

, , Django 1.6, django-mssql - 1.6. , django-mssql 1.6 Django 1.8.

DB, -

  DATABASES = {
      'default': {
          'ENGINE': 'sqlserver_ado',
          'NAME': 'dbname',                      # Or path to database file       if using sqlite3.
          # The following settings are not used with sqlite3:
          'USER': 'db_user_id',
          'PASSWORD': 'db_password',
          'HOST': 'host_name_or_ip_addr',                      # Empty for       localhost through domain sockets or '127.0.0.1' for localhost through TCP.
          'PORT': '1433',                      # Set to empty string for       default.
          'OPTIONS': {
                'provider' : 'SQLOLEDB'             # or these other two dlls did not work for me SQLCLI10, SQLCLI11
          },
      },
  }
+2

'SQLNCLI11' :

DATABASES = {
    'default': {
        'NAME': 'MyDatabase',
        'ENGINE': 'sqlserver_ado',
        'HOST': '.\\SQLEXPRESS',
        'USER': '',
        'PASSWORD': '',
        'OPTIONS': {
            'provider': 'SQLNCLI11',
            'use_legacy_date_fields': 'True'
        }
    }
}
+2

All Articles