Error:
Error 40: has occurred while establishing a connection to the server.When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (Provider: Named Pipes Provider,Could not open a connection to the SQL Server).
Error Message:
Causes:
- SQL Server [RELYONDB] service might be stopped.
- SQL Browser service might be stopped.
- Remote connections [TCP/IP and Named Pipes] might be disabled.
- Firewall on the server may refused the connection.
- Make sure that you have typed correct server computer name and instance name
- Make sure that server machine is reachable. Check you are able to ping the server.
Workaround 1:
- Click Start | Run | type “Services.msc”(Without quotes)
- Restart SQL Server RELYONDB Service and SQL Browser service.
Workaround 2:
Enable Using both TCP/IP and Named Pipes:
All programs | Microsoft SQL Server 2005| Configuration Tools | SQL Server Surface Area Configuration | Configuration for Services and Connections | Remote Connections, choose Local and Remote Connections |Enable Using both TCP/IP and Named Pipes.
Restart SQL Server RELYONDB & SQL Server Browser service.
Workaround 3:
Enable Using both TCP/IP and Named Pipes:
All programs | Microsoft SQL Server 2005| Configuration Tools | SQL Server Configuration Manager| SQL Server Network configuration| Right Click “Named Pipes” & Click Enable > Right Click “TCP\IP” & Click Enable
Restart SQL Server RELYONDB and SQL Server Browser service.
Workaround 4:
Click Start | Run | type firewall.cpl | Switch Off | Click OK.
Or
Create an exception in windows firewall.
Add TCP port or sqlservr.exe to Firewall exception list, either add “..\Binn\sqlsevr.exe” or add port.
Add Sql Browser service to Firewall exception list, you can either add program ” C:\Program Files\Microsoft SQL Server\90\Shared\sqlbrowser.exe” or add UDP port 1434.