Skip to main content

A network-related or instance-specific error occurred while establishing a connection to SQL Server - Error while connecting SQL Server

Most of developers, DBA or any persons who are working with SQL server, they have seen the error which I mentioned in the title. From the error you can easily imagine there is a something error in Server name which are trying to connect server. But when this SQL server instance working locally, then something is network issue to connect to this server or it should some configuration issue when trying to connect this SQL server instance from another server.

This is most common error or may be you have seen most of them and faced too. You may have the solution, but even I am writing here for the solution which have applied at my end. Before moving ahead, Please look the error in detail,

Cannot connect to Server

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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

Let me share screen shot  you have seen most,

Error is recommended to configure a remote server to allow to connect from another server. As I know then we should go ahead with the following steps,

1. Please make sure the SQL Browser service is enabled and running. If not, then enable it from the SQL Server configuration manager.

2. Make sure TCP/IP is enabled for that SQL Server instance.

3. Make sure “remote access” value must be  turned on from sp_configure. If not then change it with following query,
exec sp_Configure 'remote access',1
4. Make sure Ports are opened for SQL Service and SQL Browser if Windows firewall is turned on. SQL Server default port is 1433. If you changed it, then check port for TCP/IP properties and IP Addresses tab

Add port for SQL server database service

Add port for SQL server Browser service

After completion of all above steps, we will able to success to connect that SQL server instance from another server. It will be helpful and valuable to share your thought here if I missed something and need some additional steps.