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)

-> Client advised that they are trying to connect to a SQL Server named instance and getting below error,

Blog90_1

TITLE: Connect to Server
——————————
Cannot connect to JBAG1\IN01.
——————————
ADDITIONAL INFORMATION:
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)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476
——————————
BUTTONS:
OK
——————————

-> Client advised that they were able to connect to a default instance that is installed on the same server.

-> Client also advised that there were no recent network changes in the database server.

-> I wanted to make sure if SQL Services was online. In my case it was online.

-> Then I checked if Remote connection was enabled from SQL Server Instance Properties -> Connection -> “Allow remote connections to this server”. It was checked.

-> Verified if “SQL Server Browser Services” was started. It was started.

-> Checked what protocols were enabled. In my case TCP\IP and shared memory was enabled. Checked further if TCP\IP is configured to use static or dynamic port.

TCP\IP was configured with a static port of 51233.

-> Verified if there was an “inbound Rule” to allow TCP port 51233 in the firewall. It was already created.

-> Checked if there were any bad alias created in SQL Server Configuration manager or cliconfg.exe. There were none.

-> I tried executing Telnet and understood that port 51233 is open. I also got the port scan output from the client and it showed that the port was open.

-> I tried to connect to the SQL Server named instance using Servername,port instead of Servername\Instancename. The connection was successful.

-> The connection doesn’t work only if I use Servername\Instancename. I checked further and then realized that someone have changed Hide Instance to Yes in configuration manager.

Blog90_2

Blog90_3

Hide Instance : SQL Server uses the SQL Server Browser service to enumerate instances of the Database Engine installed on the computer. This enables client applications to browse for a server, and helps clients distinguish between multiple instances of the Database Engine on the same computer. Setting Hide Instance to YES will prevent the SQL Server Browser service from exposing an instance of the Database Engine to client computers that try to locate the instance by using the Browse button. Setting Hide Instance to Yes is a security best practice, but can cause issue as detailed in this post.

-> I advised this to the client and changed “Hide Instance” Setting to No and the connection went through fine. Please note that this change doesn’t require a SQL Server restart.

-> Client advised that one of their DBA’s changed this recently after a security assessment of their SQL Server instance using SQL Server vulnerability assessment report from SQL Server Management studio. Advised them that they can perform below to connect to SQL Server named instance using “Hide Instance” set to Yes,

1) Change the application connection string from Servername\Hostname to Servername,Port.

2) Create a ALIAS in SQL Server configuration manager or cliconfg.exe.

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s