Monday, January 7, 2019

Re: ms sql server connectivity to django

Hi mate,

I had the same issue with MS SQL.

This worked for me:
DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'HOST': 'xxx',
        'PORT': '1433',

        'USER': 'xxx',
        'PASSWORD': 'xxx',
        'NAME': 'xx',#table name
        'CONN_MAX_AGE': 0,
        'AUTOCOMMIT': True,

        'OPTIONS': {
            'driver': 'ODBC Driver 17 for SQL Server',
            'host_is_server': True,
            'autocommit': True,
            'driver_needs_utf8': True,
            'use_legacy_date_fields' : True,
        },
    }
}

You need to have pyodbc azure installed.

GL,
Ivan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7b00ad3b-8964-4b39-9eaa-4a204f45eb92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment