Introduction

This article explains how to configure an instance of the SQL Server Database Engine to listen on a particular fixed port by utilising the SQL Server Configuration Manager to fix SQL error 26. In my earlier article, I have thoroughly highlighted how to get database tables size in SQL Server. The default example of the SQL Server Database Engine responses (listens) especially on TCP port 1433. Named instances of the Database Engine and SQL Server Compact are arranged for dynamic ports. This implies they select an accessible port when the SQL Server administration is started over. When you are interacting with a named instance through a firewall, configure the Database Engine to listen on a particular port, so that the fitting port can be opened in the firewall.

Error Description:

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)
SQL error 26

Step 1: Run this query to view your TCP endpoints

SELECT name, protocol_desc, type_desc, state_desc, is_admin_endpoint, port, is_dynamic_port, ip_address FROM sys.tcp_endpoints

Step 2: Check for which SQL port is working

We can apply apply given below T-SQL command to check which port is working:
USE MASTER
GO
xp_readerrorlog 0, 1, N'Server is listening on'
GO

Step 3: Run below command to check applications listening on ports, try this command on command line:

>>> netstat -ap TCP

Step 4: Open immediate Run command (Windows + R) in your system

1) Now type on immediate Run command %windir%\System32\cliconfg.exe
2) Click on OK button then check an TCP ip pop-up is open
3) Left side you will see disabled protocols and right side disabled protocols.
4) Now select TCP/IP and click on "Enable", it will add to right side enabled protocols.
5) Now click on added protocols TCP/IP and hit "Properties" button and enter/verify SQL Server desired TCP/IP no, SQL Server default port is 1433.
6) At last, now hit OK button.
Fix SQL Error 26
Figure 1

Fix SQL Server 26 Enable
Figure 2

Fix SQL Server TCP-IP
Figure 3

Step 5: Open "SQL Server Configuration Manager"

  • Now Click on "SQL Server Network Configuration" OR run immediate window, type SQLServerManager10.msc to quick access to SQL Server Configuration Manager  and Click on "Protocols for Name"
  • Right Click on "TCP/IP" (make sure it is Enabled) Click on Properties, if it is Disabled then Enabled it.
  • Now Select "IP Addresses" I to VI Tab and Enter TCP Default Port
  • Enter "TCP Port" 1433.
  • TCP Dynamic Ports ===> remove 0 (keep blank).
  • Now Restart "SQL Server Name." using "services.msc" (winKey + r)
  • OR Restart SQL Server (right click on SQL Server Management studio and then click on Restart, it will restart your SQL Server).
sql server configuration manager client protocols
Figure 1

sql server configuration manager client protocols TCP IP
Figure 2

sql server configuration manager protocols
Figure 3

sql server configuration manager TCP IP
Figure 4

sql server configuration manager TCP IP
Figure 5

Conclusion

I have above provided all necessary steps to fix SQL error: 26 - A network-related error occurred in SQL Server. If anyone still finds the same error, please write here to further detail.

Video: Fix SQL error: 26 - A network-related error occurred in SQL Server

Relevant Reading