Error:
An error has occurred while establishing a connection to the server. When connecting to Sql Server 2005, the failure may be caused by the fact that under the default settings Sql server does not allow remote connections. (Provider: TCP Provider, Error: 0 – A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
Snapshot:
Causes:
Server side:
Make sure that you have enabled remote connections on the instance
Make sure that firewall is OFF.
Create an exception for SqlBrowser and SqlServer in server computer.
Client side:
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.
Make sure that you are able to access the shared folder of remote server.
Make sure that you are able to connect SQL Server using the Telnet command.
Workaround 1:
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 |Select Using both TCP/IP and Named Pipes | Click Apply
Restart SQL Server RELYONDB & SQL Server Browser service.
Workaround 2:
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 3:
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.
Workaround 4: [Client side]
Check whether PINGing is happening in both client and server systems
Click Start | Run | type cmd| Click OK
Open command prompt as Run as Administrator | Type PING <ServerIPAddress>
Workaround 5: [Client side]
Resolve DNS cache:
Click Start | Run | type cmd| Click OK
Open command prompt as Run as Administrator | type ipconfig /flushdns
Workaround 6: [Client side]
Give server IP address in connection string instead of hostname.