Hi Sahan,

"the target machine actively refused it” - in TCP parlance, that means that there’s nothing listening on that port, aka “connection refused”. The server you are trying to connect to isn’t there (or there is a firewall similar blocking the connection - but doubt it).

IIRC by default SQL Server runs each instance on its own port, and uses a broker (aka “browser service”) to determine which instance you are connecting to (on port 1434?). See this link for more info:

https://learn.microsoft.com/en-us/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access?view=sql-server-ver16

Again, from memory (which may not be accurate), each instance may have a “dynamic port” allocated but will consistently expose itself on the same port each time it is started. So locking in a particular port in Django is normally ok. You just need to determine what port that is. :-)

The db connector in Django knows or understands the dynamic connection strategy that SQL Server uses, but needs the port number directly assigned to the instance..

HTH,
/d


------ Original Message ------
From "Sahan Srinivas" <26sa...@gmail.com>
To "Django users" <django-users@googlegroups.com>
Date 2/11/2023 3:48:49 AM
Subject Facing Issue with ODBC Driver 17 for SQL Server

Hi All,

I am facing an issue with the DJANGO SQL Driver below is the screenshot, It is showing the error as

django.db.utils.OperationalError: ('08001', '[08001] [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it.\r\n (10061) (SQLDriverConnect)

Below are my Database details in settings.py file.

DATABASES ={
    'default':{
    'ENGINE':"sql_server.pyodbc",
    'NAME':"IRIS",
    'USER':"sa",
    'PASSWORD':'admin123#',
    'HOST':'Pegasus\MSSQLSERVER2022',
    'PORT':'1433',
    'OPTIONS':{
    'driver':'ODBC Driver 17 for SQL Server',
    },
  },
}

Can anyone help me out? The driver's are installed, the same I can run using SQL alchemy

Kind Regards,
Sahan



--
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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/208fbabc-c1c9-4770-8428-0679927a6005n%40googlegroups.com <https://groups.google.com/d/msgid/django-users/208fbabc-c1c9-4770-8428-0679927a6005n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/em38f13ab2-5dc4-4215-bc66-117f4dd523a5%403845105e.com.

Attachment: pgphTcO8orPEF.pgp
Description: PGP signature

Reply via email to