” A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Shared Memory Provider, error: 40 – Could not open a connection to SQL Server) (.Net SqlClient Data Provider) “
Hi everybody ,one evening, i opened SQL Server management studio and tried to connect to my SQL Server 2014 instance .but i could not connect to SQL Server and i got an error message as shown above.
So i tried to fix it in different ways .Today i am going to explain all solutions for the SQL error 40 – ” Could not open a connection to SQL Server”.
1. Make sure that you have started SQL Server 2014 instance by checking SERVICES.MSC or SQL Server Configuration Manager.
A. Using SERVICES.MSC
Open Services.msc and do as shown in the below picture
Click Start button to fix ” Could Not Open a Connection to SQL Server “
B.Using SQL Server Configuration Manager
Click Start button to fix ” Could Not Open a Connection to SQL Server ”
2.Make Sure that SQL Server 2014 instance , TCP/IP port is enabled and check default port number 1433 is assigned .if you have more than one SQL Server instance in the system ,one SQL Server instance will take TCP/IP default port number 1433 and for second SQL Server instance ,we can give another port number manually . if we don’t give a TCP/IP port number for second SQL Server instance manually ,It automatically gets another port number .
Open SQL Server Configuration Manager and do as shown in the below pictures.
Okay ,We enabled TCP/IP now and let us check Port Number
After Enabling TCP/IP and assigning port number ,we have to restart SQL Server instance ,in order to effect the changes that we made in the SQL Server. Please check now that SQL Server error 40 is fixed.
3.Another fix for SQL server error 40 is to Tick Allow remote connections to this server.So we need to open SQL Server Management Studio and Right Click SQL Server instance name and choose Connections then Tick Allow remote connections to this server and Click OK button .
Any of the above three solutions helped me to fix the SQL Server error 40 ” Could not open a connection to SQL Server”.So if you have any another fix for the error .please comment below ,it will help a lot of SQL DBA around the world