2

I have already tried out all the suggestions in other posts.

I am trying to connect SQL Server to Django on a Linux CentOS 7 with a virtual environment.

I am getting the following error:

    ) from e_user
django.core.exceptions.ImproperlyConfigured: 'sql_server.pyodbc' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
    'mysql', 'oracle', 'postgresql', 'sqlite3'

The setting are the following:

Django==2.1.15
django-bootstrap3==14.2.0
django-db-tools==0.0.1
django-filter==2.4.0
django-mathfield==0.1.0
django-model-utils==4.1.1
django-mssql-backend==2.8.1
django-pyodbc-azure==2.1.0.0
django-tables2==2.3.4
django-widget-tweaks==1.4.8
importlib-metadata==1.7.0
pyodbc==4.0.30
pytz==2020.5
sql-server.pyodbc==1.0
sqlparse==0.4.1
zipp==3.4.0

This is my odbcins.ini file:


[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.6.so.1.1
UsageCount=1

This is the odbc.ini

Driver = ODBC Driver 17 for SQL Server
Server = IP
Database = dbNAME
Trace = Yes
TraceFile = /tmp/odbc.log

And my settings.py


DATABASES = {
    'default': {
        'ENGINE' : 'sql_server.pyodbc',
        'NAME': 'dbNAME',
        'HOST' : 'IP',
        'PORT' : '8000',
        'USER': 'username',
        'PASSWORD': 'passwrd',
        'OPTIONS': {
            'driver': 'ODBC Driver 17 for SQL Server',
        },
    },
}

I have tried out to reinstall django-pyodbc-azure as they suggested here Django python 'sql_server.pyodbc' isn't an available database backend

but it didn't work for me. I also tried to reinstall the ODBC driver.

Appreciate your help Thanks

Alicia Pliego
  • 181
  • 10
  • Have you seen ['sql_server.pyodbc' isn't an available database backend](https://github.com/ESSolutions/django-mssql-backend/issues/37)? davidjb there uninstalled and reinstalled to fix their issue, `pipenv uninstall django-mssql-backend` `pipenv install django-mssql-backend` – AlwaysLearning Jan 21 '21 at 12:53
  • I tried, but I still get the same error... – Alicia Pliego Jan 21 '21 at 13:40

0 Answers0