{"id":106869,"date":"2025-07-07T13:23:35","date_gmt":"2025-07-07T13:23:35","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=106869"},"modified":"2025-12-15T11:05:32","modified_gmt":"2025-12-15T11:05:32","slug":"common-sql-server-problems-network-related-or-instance-specific-error-occurred","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/featured\/common-sql-server-problems-network-related-or-instance-specific-error-occurred\/","title":{"rendered":"Common SQL Server Problems: Network Related or Instance Specific Error Occurred"},"content":{"rendered":"\n<p>This is the first in a series of articles meant to provide practical solutions to common issues. In this post, we\u2019ll talk about one of the most pervasive error messages out there:<\/p>\n\n\n\n<p class=\"has-roboto-mono-font-family has-sm-font-size\">A network-related or instance-specific error occurred while establishing a connection to SQL Server. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.<\/p>\n\n\n\n<p>Followed by either:<\/p>\n\n\n\n<p class=\"has-roboto-mono-font-family has-sm-font-size\">(provider: SQL Network Interfaces, error: 26 \u2013 Error Locating Server\/Instance Specified)<\/p>\n\n\n\n<p>or<\/p>\n\n\n\n<p class=\"has-roboto-mono-font-family has-sm-font-size\">(provider: Named Pipes Provider, error: 40 &#8211; Could not open a connection to SQL Server)<\/p>\n\n\n\n<p>One thing I\u2019ll say right off the bat:<strong> This is not a permissions issue.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-debugging-steps\">Debugging Steps<\/h2>\n\n\n\n<p>People often come to my team when they encounter this error, but we can rarely offer a simple, one-size-fits-all answer.  But more often than not, the solution to their issue is one of the following:<\/p>\n\n\n<div class=\"block-core-list\">\n<ol class=\"wp-block-list\">\n<li style=\"padding-top:var(--wp--preset--spacing--sm);padding-bottom:var(--wp--preset--spacing--sm)\"><strong>The server could actually be down<\/strong>. (We do verify this before we send them away!). <\/li>\n\n\n\n<li style=\"padding-top:0;padding-bottom:0\"><strong>It could be a typo in the connection string<\/strong>. Sometimes it really is as simple as verifying that the instance name is correct. This includes cases where you are specifying an instance name and shouldn\u2019t be, or vice-versa. If you\u2019re using SQL Server Express, often it means you should be using <code>myserver\\SQLEXPRESS<\/code> or <code>localhost\\SQLEXPRESS<\/code>. Check the instance names that are actually running in <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/tools\/configuration-manager\/sql-server-configuration-manager\" target=\"_blank\" rel=\"noreferrer noopener\">SQL Server Configuration Manager<\/a>:<div class=\"block-core-list\">\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li> Open Configuration Manager <\/li>\n\n\n\n<li> Expand \u201cSQL Server Network Configuration\u201d <\/li>\n\n\n\n<li>Review the \u201cProtocols for\u201d items listed there:<div class=\"block-core-list\">\n<ol style=\"list-style-type:lower-roman\" class=\"wp-block-list\">\n<li><code>MSSQLSERVER<\/code> is the default instance. That means you specify the server name but no instance name. <\/li>\n\n\n\n<li> Any other value is a named instance. That means you specify the server name and the instance name, in the form <code>SERVERNAME\\INSTANCENAME<\/code> (though some applications and libraries expect those parameters to be provided separately). <\/li>\n<\/ol>\n<\/div><\/li>\n<\/ol>\n<\/div><\/li>\n\n\n\n<li style=\"padding-top:var(--wp--preset--spacing--sm);padding-bottom:var(--wp--preset--spacing--sm)\"><strong>It could be DNS.<\/strong><div class=\"block-core-list\">\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li> Make sure <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows-server\/administration\/windows-commands\/nslookup\" target=\"_blank\" rel=\"noreferrer noopener\">nslookup<\/a> and\/or <a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/dnsclient\/resolve-dnsname\" target=\"_blank\" rel=\"noreferrer noopener\">Resolve-DNSName<\/a> return the result(s) you expect when querying the name in the connection string. <\/li>\n\n\n\n<li> Try connecting by IP address instead of server name. <\/li>\n\n\n\n<li> Try using the fully-qualified domain name (FQDN) \u2013 e.g. <code>myserver.mydomain.com<\/code> instead of just <code>myserver<\/code>. <\/li>\n\n\n\n<li> Validate the results of <a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/nettcpip\/test-netconnection\">Test-NetConnection<\/a> \u2013 both without a port and with -Port 1433 (or whatever port SQL Server is running on) from the machine trying to connect, not from the database server or from your workstation. <\/li>\n\n\n\n<li> Don\u2019t rely on ping \u2013 often ping and other ICMP traffic will be rejected by design, so an unsuccessful ping isn\u2019t necessarily evidence that the server is unreachable on SQL Server-specific ports. <\/li>\n<\/ol>\n<\/div><\/li>\n\n\n\n<li><strong>Check to see if the server is configured to allow remote connections.<\/strong><div class=\"block-core-list\">\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li> In <a href=\"https:\/\/learn.microsoft.com\/en-us\/ssms\/\">SSMS<\/a>, right-click the server, and select <strong>Properties<\/strong>. <\/li>\n\n\n\n<li> On the Connection tab, make sure \u201cAllow remote connections to this server\u201d is checked. <\/li>\n\n\n\n<li> If necessary, check the box, and restart the SQL Server service (following established process, of course \u2013 please don\u2019t take down production and then say, \u201cAaron told me to!\u201d). <\/li>\n<\/ol>\n<\/div><\/li>\n\n\n\n<li style=\"padding-top:var(--wp--preset--spacing--sm);padding-bottom:var(--wp--preset--spacing--sm)\"><strong>Check availability group settings.<\/strong> If using an availability groups listener, make sure the database name is in the connection string and that <code>MultiSubnetFailover=True<\/code> is included. Otherwise, you could get directed to an IP that is not actively hosting any resources for the availability group. <\/li>\n\n\n\n<li><strong>TCP\/IP may be disabled<\/strong>. This is the default behavior for some versions and editions. You can enable this through SQL Server Configuration Manager:<div class=\"block-core-list\">\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li> Open Configuration Manager. <\/li>\n\n\n\n<li> Expand \u201cSQL Server Network Configuration.\u201d <\/li>\n\n\n\n<li> Highlight \u201cProtocols for\u201d the instance you want to affect. <\/li>\n\n\n\n<li> In the right pane, check that \u201cTCP\/IP\u201d is enabled. <\/li>\n\n\n\n<li> If necessary, right-click, Enable, then restart the SQL Server service (following established process, of course). <\/li>\n<\/ol>\n<\/div><\/li>\n\n\n\n<li style=\"padding-top:var(--wp--preset--spacing--sm);padding-bottom:var(--wp--preset--spacing--sm)\"><strong>Check the Port.<\/strong> The server could be running on a port you didn\u2019t expect. You can check the port it\u2019s running on via <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/tools\/configuration-manager\/sql-server-configuration-manager\" target=\"_blank\" rel=\"noreferrer noopener\">SQL Server Configuration Manager<\/a>:<div class=\"block-core-list\">\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li> Open Configuration Manager. <\/li>\n\n\n\n<li style=\"padding-top:0;padding-bottom:0\"> Expand \u201cSQL Server Network Configuration.\u201d <\/li>\n\n\n\n<li> Highlight \u201cProtocols for\u201d the instance you are trying to reach. <\/li>\n\n\n\n<li> In the right-pane, right-click TCP\/IP and select Properties. <\/li>\n\n\n\n<li>On the IP Addresses tab, scroll to IPAll and see what port is listed under either TCP Dynamic Ports or TCP Port.<div class=\"block-core-list\">\n<ol style=\"list-style-type:lower-roman\" class=\"wp-block-list\">\n<li> If using TCP Port, change your connection string to reference that port explicitly, e.g. myserver.mydomain.com,1488. <\/li>\n\n\n\n<li> If using TCP Dynamic Ports, see the section below about firewall\/routing, because you won\u2019t want to hard-code the port for a named instance, since the port will be reassigned on service restart. <\/li>\n<\/ol>\n<\/div><\/li>\n<\/ol>\n<\/div><\/li>\n\n\n\n<li><strong>Check the Docker connection details.<\/strong> If you are using <a href=\"https:\/\/www.docker.com\/\">Docker<\/a>, it is pretty common to expect SQL Server inside the container to run on the <em>host\u2019s<\/em> port 1433, so people expect to connect \u2013 particularly from within another container \u2013 via <code>localhost<\/code> or <code>127.0.0.1<\/code>.<div class=\"block-core-list\">\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li> You should set your SQL Server container to expose port 1433 on a dedicated port on the host machine, e.g. <code>docker run \u2026 -p 6000:1433<\/code>, then you can connect to <code>localhost,6000<\/code>. <\/li>\n\n\n\n<li> You can also look at using <a href=\"https:\/\/medium.tuanh.net\/facts-about-the-differences-between-localhost-127-0-0-1-and-host-docker-internal-fb1e1f8644f5\" target=\"_blank\" rel=\"noreferrer noopener\">host.docker.internal<\/a>. <\/li>\n<\/ol>\n<\/div><\/li>\n\n\n\n<li style=\"padding-top:var(--wp--preset--spacing--sm);padding-bottom:var(--wp--preset--spacing--sm)\"><strong>It could be firewall\/routing<\/strong>.<div class=\"block-core-list\">\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>It could be that ports 1433 (TCP) and\/or 1434 (UDP) are not open. This could be due to:<div class=\"block-core-list\">\n<ol style=\"list-style-type:lower-roman\" class=\"wp-block-list\">\n<li> Windows Defender firewall \u2013 to validate this in a home lab, just turn the service off temporarily (on both the machine trying to connect and, on the server). In a corporate setting, please work with your IT and\/or networking teams before playing with native firewalls. <\/li>\n\n\n\n<li> A real firewall, load balancer, or other routing devices\/rules in your network \u2013 work with your IT and\/or networking teams. <\/li>\n\n\n\n<li> If you\u2019re trying to connect to database resources in Azure or some other cloud, make sure you have added your IP address\/range to inbound allow rules, and that you prefix the FQDN with <code>tcp:<\/code> to force TCP\/IP , e.g. for Azure SQL Database, use <code>tcp:myserver.database.windows.net,1433<\/code>. <\/li>\n<\/ol>\n<\/div><\/li>\n\n\n\n<li> Within a cloud environment, it could be that your resource groups or environments don\u2019t share a common network. It may very well be by design that the app running in your staging environment is not able to access the databases in your production environment. In Azure, ensure that the SQL Server firewall settings enable \u201cAllow Azure services and resources to access this server.\u201d <\/li>\n\n\n\n<li>If you are using a named instance, it will use dynamic ports by default. This requires the SQL Server Browser service to be enabled and running, and reachable via port 1434. If you can\u2019t rely on this, you may have to work with your networking or reliability engineering team to agree on a specific port to use, then set that explicitly for the service using SQL Server Configuration Manager:<div class=\"block-core-list\">\n<ol style=\"list-style-type:lower-roman\" class=\"wp-block-list\">\n<li> Open Configuration Manager. <\/li>\n\n\n\n<li> Expand \u201cSQL Server Network Configuration.\u201d <\/li>\n\n\n\n<li> Highlight the \u201cProtocols for\u201d the instance you want to affect. <\/li>\n\n\n\n<li> In the right pane, right-click TCP\/IP and select Properties. <\/li>\n\n\n\n<li> Remove any ports from TCP Dynamic Ports. <\/li>\n\n\n\n<li> Add the agreed-upon port to TCP Port. <\/li>\n\n\n\n<li> Click Apply\/OK, then restart the SQL Server service (following established process, of course). <\/li>\n<\/ol>\n<\/div><\/li>\n<\/ol>\n<\/div><\/li>\n<\/ol>\n<\/div>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1239\" height=\"1020\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2025\/05\/a-screenshot-of-a-computer-ai-generated-content-m-5.png\" alt=\"A screenshot of a computer\n\nAI-generated content may be incorrect.\" class=\"wp-image-106870\" srcset=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2025\/05\/a-screenshot-of-a-computer-ai-generated-content-m-5.png 1239w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2025\/05\/a-screenshot-of-a-computer-ai-generated-content-m-5-300x247.png 300w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2025\/05\/a-screenshot-of-a-computer-ai-generated-content-m-5-1024x843.png 1024w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2025\/05\/a-screenshot-of-a-computer-ai-generated-content-m-5-768x632.png 768w\" sizes=\"auto, (max-width: 1239px) 100vw, 1239px\" \/><\/figure>\n\n\n\n<p>\n  \n<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-let-me-know-if-you-know-any-other-fixes-for-this-problem\">Let me know if you know any other fixes for this problem<\/h2>\n\n\n\n<p>Those are the most common fixes I see for the \u201cA network-related or instance-specific error\u2026\u201d messages. Do you have additional fixes or comments about the ones I\u2019ve listed? Please leave a comment below!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the first in a series of articles meant to provide practical solutions to common issues. In this post, we\u2019ll talk about one of the most pervasive error messages out there: A network-related or instance-specific error occurred while establishing a connection to SQL Server. Verify that the instance name is correct and that SQL&#8230;&hellip;<\/p>\n","protected":false},"author":341115,"featured_media":106905,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[53,143524],"tags":[159371,4151,159322],"coauthors":[158980],"class_list":["post-106869","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-featured","category-sql-server","tag-common-issues-in-sql-server","tag-sql-server","tag-troubleshooting-sql-server"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/106869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/341115"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=106869"}],"version-history":[{"count":7,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/106869\/revisions"}],"predecessor-version":[{"id":106884,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/106869\/revisions\/106884"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media\/106905"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=106869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=106869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=106869"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=106869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}