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

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

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

Under certain circumstances, there are cases where you might try to connect to a SQL Server instance and get the error message: “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)

 

Article on SQLNetHub: A network-related or instance-specific error occurred while establishing a connection to SQL Server.

 

This is the standard error message you get when your client does not “see” the SQL Server instance you are trying to connect to. However, there is more than one possible reasons for getting this message.

Here’s a list of possible reasons:

  • [Reason 1] You may have misspelled the instance name or IP 🙂
    • How to further investigate: 
      From the client, try to ping the network name for the SQL Server instance and see if you get a response.

      • If it is a default instance (i.e. SQLInstance1.contoso.local) then ping “SQLInstance1.contoso.local”
      • If it is a named instance  (i.e. VirtualName1.contoso.local\SQLInstance1) then ping “VirtualName1.contoso.local”
        > If ping does not reply, make sure that you are using the correct network name.
        > If you still cannot connect to SQL Server, proceed and check the rest of possible reasons.

 

  • [Reason 2] If the SQL Server instance is located on a different domain than your client, you may have not included the fully qualified domain name (FQDN) in the SQL Server instance name (i.e. SQLInstance1 vs SQLInstance1.contoso.local) – this assumes that the two domains are trusted between them
    • How to further investigate:
      Again, just like the actions in possible reason 1, try to ping the instance name from the client using the instance’s FQDN.
      > If you still cannot connect to SQL Server, proceed and check the rest of possible reasons.

 

  • [Reason 3] If there is a firewall in your network, you might not be allowed to access the SQL Server instance through the network.
    • How to further investigate:
      If you know for example that you want to connect to the SQL Server instance “SQLInstance1.contoso.local” on port 52500, then you can try from a command prompt on the client, to run the command: telnet SQLInstance1.contoso.local 52500
      If the above telnet command reports that “Could not open connection to the host, on port 52500: Connect failed” (or something similar), it means that there is no network communication between the client and the SQL Server instance at the designated port number. In this case, you should report it to your Network administrator.

 

  • [Reason 4] If you are trying to connect to a named instance, make sure that the SQL Server Browser service is running.
    • How to further investigate:
      Remotely connect on the SQL Server machine (or via remote administration) and check that the “SQL Server Browser” service is up and running.

 

  • [Reason 5] Make sure that your SQL Server instance allows remote connections.
    • How to further investigate:
      Connect remotely on the SQL Server machine, and log in to SQL Server Database Engine via SQL Server Management Studio. Then, right-click on the instance name, select “Properties” and check the “Connections” tab to see if the SQL Server instance allows remote connections. See the below screenshot for example.Article on SQLNetHub: A network-related or instance-specific error occurred while establishing a connection to SQL Server.

 

Hopefully if you go through the above, you will finally manage to successfully connect to your SQL Server instance.

Drop me a line if you would like to further discuss this!

 

Check out our latest software releases!

Subscribe to our newsletter and stay up to date!

Easily generate snippets with Snippets Generator!

Secure your databases using DBA Security Advisor!

Convert static T-SQL to dynamic and vice versa with Dynamic SQL Generator.

 

Rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)

Loading...

Reference: SQLNetHub.com (https://www.sqlnethub.com)

© 2018 SQLNetHub

 

Artemakis Artemiou
Artemakis Artemiou is a Senior SQL Server and Software Architect, Author, and a former Microsoft Data Platform MVP (2009-2018). He has over 15 years of experience in the IT industry in various roles. Artemakis is the founder of SQLNetHub and TechHowTos.com. Artemakis is the creator of the well-known software tools Snippets Generator and DBA Security Advisor. Also, he is the author of many eBooks on SQL Server. Artemakis currently serves as the President of the Cyprus .NET User Group (CDNUG) and the International .NET Association Country Leader for Cyprus (INETA). Artemakis's official website can be found at aartemiou.com.