To resolve following error , follow the steps specified below:
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
OR
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: Named Pipes Provider, error: 28 - server does not support requested protocol)
Check the following things if remote access is failed :
1)Allow Remote Connections to this server
This must be enabled to allow remote connections to the server. To enable this , Go to start – > All Programs – > Microssft Sql Server 2008 –> Sql Server Management Studio.
Now connect to the instance to which you need to enable remote access. Now right click on the instance and select “Properties”. Select “Connections” from left side and see if “Allow Remote Connections to this server” is checked or not. If unchecked , check it to allow remote access.
2)Enable TCP/IP protocol and Sql Server Browser
Open Sql Server Configuration Manager.
Go to start – > All Programs – > Microssft Sql Server 2008 –> Configuration Tools –> Sql server configuration Manager
TCP/IP protocol
Expand “Sql Server Network Configuration” in the left pane , Double click on “Protocols for MSSQLSERVER” ( Protocols for YourServerInstanceName) . Enable TCP/IP .
Some times TCP/IP under Sql Native Client 10.0 Configuration –>Client Protocols –>TCP/IP might also be disabled . Check this and enable it.
It gives the following message ,
so restart the sql server service . under Sql Server Configuration Manager –> Sql Server Services –> Sql Server (Your Instance Name)
Sql Server Browser
under Sql Server Configuration Manager –> Sql Server Services –>Sql Server Browser
Right click and enable it.
4)Firewall
In Start –> Run , give the command “controlpanel.cpl” and click enter.
or
Start – > Control Panel –> Windows Firewall - >Allow a program or feature through firewall
Browse “Sqlserver.exe” and add.