svgy
svgy

Reputation: 11

why does 'Django mssql connection error' happen?

i have an ready database and I wanna use it in django web project. but I have an error about connection.

here is the error

raise NotSupportedError('SQL Server v%d is not supported.' % ver) django.db.utils.NotSupportedError: SQL Server v16 is not supported.

here is the packeges

asgiref              3.5.2
Django               2.1.15
django-mssql-backend 2.8.1
django-pyodbc-azure  2.1.0.0
django-pyodbc-azure-2019  2.1.0.0
mssql-django         1.2
pip                  22.0.4
pyodbc               4.0.35
pytz                 2022.7
setuptools           58.1.0
sqlparse             0.4.3
tzdata               2022.6

and database settings

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME':'veritabanıProje2',
        'USER': 'sa',
        'PASSWORD':'**',
        'HOST':'DESKTOP-MDLFE99',
        'PORT':'',
        'OPTIONS':{
            'driver':'ODBC Driver 17 for SQL Server',

        },

    },
}

I'm using SQL server 2022.

also the db file's name DB.sql in project directory. but I write here the name that is written while I create database. (I tried with DB.sql also of course)

I can understand the fault is about version but which one is wrong I dont know.

Upvotes: 1

Views: 991

Answers (1)

Aliferous_rahul
Aliferous_rahul

Reputation: 11

It may be due to several reasons such as-

Incorrect database connection settings: Make sure that you have entered the correct database name, server name, and login credentials in your Django settings.

Network issues: If your Django application is unable to connect to the database server, it could be due to network issues such as a firewall blocking access or a network configuration problem.

Incorrect version of Django or Python: Make sure that you are using a version of Django and Python that is compatible with the version of the Microsoft SQL Server database you are trying to connect to

I will update if i can get more source

Upvotes: 1

Related Questions