Issue
I'm using SQL Server as the backend for the database. In the setting.py
file, I need to use the host name with instance. Due to this, I got the error given below:
The above exception (('08001', '[08001] [Microsoft][SQL Server Native Client 11.0]TCP Provider: No connection could be made because the target machine actively refused it.\r\n (10061) (SQLDriverConnect); [08001] [Microsoft][SQL Server Native Client 11.0]Login timeout expired (0); [08001] [Microsoft][SQL Server Native Client 11.0]Invalid connection string attribute (0); [08001] [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. (10061)')) was the direct cause of the following exception:
# "settings.py"
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'xxxxx',
'USER': 'xxx',
'PASSWORD': 'xxxx',
'PORT': '1433',
'HOST': 'aaa\bbb',(hostname\instance)
'OPTIONS': {
'driver': 'SQL Server Native Client 11.0',
},
}
}
How could I resolve this error and connect with my database?
Solution
Since your settings.py looks fine,I think its a general issue that can be caused from multiple wrong configurations on the database side, such as:
- TCP/IP Connections are disabled in the SQL Server Configuration Management
- In TCP/IP properties in the "IP ALL" section port 1433 could not be configured, so it refuses to your requests
- One of many SQL windows services suddenly could be stopped
I found this stack overflow post very useful with multiple answers that covers each of the points above.
Answered By - JimShapedCoding
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.