8

I would like to use Django 2.0 with legacy MS SQL Server database.

Latest information regarding usage Django with MS SQL Server i could find is Using Sql Server with Django in production/These days and it is about Django 1.11 Most supported seems django-pyodbc-azure but it's not supporting Django 2.0 yet: django-pyodbc-azure issue #124

Is there any alternative?

3
  • Would you please share your configuration and error trace? Commented Jan 8, 2018 at 9:49
  • I tried pip install django-pyodbc-azure but it want's to downgrade Django to 1.11, so I canceled it. Commented Jan 8, 2018 at 11:02
  • Would love to know how you resolve this... would rather not downgrade... Commented Jan 18, 2018 at 21:36

2 Answers 2

12

Found the solution and post it if anyone facing same problem.

I used django-pyodbc-azure 2.0.4.1 in my Django 2.0.4

The settings that worked for me:

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'dbName',
        'USER': 'yourUserName',
        'PASSWORD': 'yourPassword',
        'HOST': '(local)',
        'PORT': '',
        'OPTIONS': {
            'driver': 'ODBC Driver 11 for SQL Server',
        },
    }
}
Sign up to request clarification or add additional context in comments.

1 Comment

good formatting on your answer. Welcome to StackOverflow buddy :)
0

I was facing same error of ODBC Driver Manager

django.db.utils.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manag er] Data source name not found and no default driver specified (0) (SQLDriverCon nect)')

Solution: When i added below code in database connection, then my error fixed.
'OPTIONS': { 'host_is_server': True, 'driver': 'ODBC Driver 11 for SQL Server', }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.