ms sql server connectivity to django

32 views
Skip to first unread message

Praveen Kumar

unread,
Jan 6, 2019, 12:56:09 PM1/6/19
to Django users
Hi All,

Changed DATABASE code as under in setting.py in Django project. But not getting able to connect to MS SQL Server. Please suggest.

ATABASES = {
    'default': {
        'NAME': 'APJ_AIM_LITE',
        'ENGINE': 'sqlserver_ado',
        'HOST': 'DB_SERVER',
        'USER': '',
        'PASSWORD': '',
    }
}

BALA KRISHNAN

unread,
Jan 7, 2019, 1:34:19 AM1/7/19
to django...@googlegroups.com
Create your database in MySQL
Migrate your files 

--
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...@googlegroups.com.
To post to this group, send email to django...@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/ee503251-d646-4585-b773-0b1fc5b11c66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jani Tiainen

unread,
Jan 7, 2019, 3:39:05 AM1/7/19
to django...@googlegroups.com
Hi,

What happens? Do you get errors? Nothing?

--
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...@googlegroups.com.
To post to this group, send email to django...@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/ee503251-d646-4585-b773-0b1fc5b11c66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...
Message has been deleted

pahlawanto...@gmail.com

unread,
Jan 7, 2019, 5:13:31 AM1/7/19
to django...@googlegroups.com

Make sure the port MSSQL is open.

Ivan Martić

unread,
Jan 7, 2019, 5:16:02 AM1/7/19
to Django users
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
Reply all
Reply to author
Forward
0 new messages