why does 'Django mssql connection error' happen? - sql-server

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.

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

Related

Laravel database connection to separate SQL Server

I have a tricky one here that I'm looking for advice to see how much flexibility we have with a project.
We have a database that is hosted on a server locally that we can remote desktop into. I have the credentials and the domain example: SQL-CVW\BRADNAMS and I have the database name BRENT and the user and login that works for the program that the database feeds.
I can login to the remote desktop and open the database using SQL Server Management Studio but I need to be able to access it through Laravel.
I have tried using the sqlsrv setup in my .env file and I have the pdo_sqlsrv and sqlsrv php extensions installs.
I try to run php artisan migrate and I get the following error:
SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: The wait operation timed out.
(SQL: select * from sysobjects where type = 'U' and name = migrations)

MS SQL Server dotnet core connection issues

I'm using ASPNetBoilerplate and attempting to deploy docker images of an ASP.NET MVC/Vue.js app. The app builds and runs fine on development environments with a trusted connection to a local SQL Server. When I try to deploy to docker running on Ubuntu 20 attempting to connect to SQL Server running on a Windows 2019 Server I am consistently getting
Login failed for user '[removed]'.
Reason: Password did not mach for the login provided. [Client xxx.yyy.zzz.aaa]
I can use those exact same credentials to connect to the database server using either Azure Data Studio or SQL Server Management Studio.
It turns out that dotnet core is a bit picky about how a SQL Server is called in the connection string. I had to include the port, even though it is the standard port.
Working Connection String:
Server=172.16.0.19,1433; Database=Db; User Id=Uid; Password=Pass;
Non-working Connecting String, throwing a Login error as listed in the question:
Server=172.16.0.19; Database=Db; User Id=Uid; Password=Pass;
To Use Docker with Asp.net Boiler Plate I try this connection string and it works fro me
{
"ConnectionStrings": {
"Default": "Server=10.0.75.1,1433; Database=MyProjectDb; User ID=sa;Password=PASSWORD';Trusted_Connection=False;MultipleActiveResultSets=True;"
},
Note : 10.0.75.1 is the default docker internal switch
Both Local & Staging is working
"ConnectionStrings": {
"Default": "Server=host.docker.internal,1433; Database=ms19Db;User=sa; Password=yourStrong(!)Password;"
},

How to Expose SQL Server Hosted on Intranet to Connect Remotely

I am trying to remote connect to a SQL Server that is hosted on a company intranet. Ultimately, I would like to connect in with something like tedious and get the data into a web application via a REST API.
I followed this tutorial: https://blogs.msdn.microsoft.com/friis/2016/08/25/setup-iis-with-url-rewrite-as-a-reverse-proxy-for-real-world-apps/
Entered the client_net_address:1433 for the inbound rule.
Disabled SSL Offloading
Entered the public facing IP of the server in the outbound To: field but changed the last digits. e.g. xxx.xxx.xxx.100
When I try logging in with tedious I get a connection timeout error using the following config:
let config = {
userName: "**",
password: "**",
server: "xxx.xxx.xxx.100",
options:{
port: 1433,
database: "db_name",
encrypt: true
}
}
What steps must I take to connect remotely to a SQL database hosted on an intranet?
Currently I VPN in and can query from SQL Server 2014 Management Studio.
This feature is working for node module mssql version 3.3.0 and SQL Server 2008.
Use npm install mssql#3.3.0 and connectivity should work properly.
Version 4 of the mssql module has breaking changes.

Liferay 6.2 bundled with jBoss connect to SQL Server 2012 with Windows Authentication

I was asked to install Liferay 6.2 bundled with jBoss to connect to SQL Server 2012.
I don't understand why Liferay cannot connect to the database with the JDBC URL as follows:
jdbc:jtds:sqlserver://DBSERVER/lportaldb;instance=lportal_DSN;useNTLMv2=true;domain=GLS.com.au
where,
DBSERVER: server name
lportalDB is database name
lportal_DSN is data source name that I created in Control Panel/Administrative Tools/ODBC Data Sources (64-bit) and successfully tested the connection.
I've tried adding and removing some properties; such as useNTMLv2, I also put ntlmauth.dll to C:\Windows and C\Windows\SysWOW64 but the Liferay portal is still not be able to connect to the database.
Any idea on this is appreciated.
There was check to the connection, LDAP, AD, DNS to the DBSERVER by IT group that fixed this issue. Regarding to the DB, it was changed to use SQL Server Authentication.
The following JDBC URL was used with user sa and password:
jdbc:jtds:sqlserver://DBSERVER/lportaldb;instance=lportal_DSN;

codeigniter connectivity with mssql using sqlsrv driver in wamp server

I am not able to connect the mssql with codeigniter in wamp server
I am getting the following error
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: C:\wamp\www\secure.leaftrack.com\system\database\DB_driver.php
Line Number: 124
After a few day of problems my company was able to solve this.
We were using the dll for mssql from PHP version 5.2.11. Once we updated to 5.2.17 it was fixed!

Resources