A network-related or instance-specific error occurred while establishing a connection to SQL Server
This is very common issue and faced by many database users while connecting to database. When you try to connect to SQL Server, you may get error as:
“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: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: )“
I am listing few troubleshooting steps which may help you to resolve connection issues and you will be able to connect to database.
-> Check if SQL Server Services running or not from SQL Server Configuration Manager (start the service if not running).
-> Check if you are entering correct server name to connect SQL Server (eg. ServerName\InstanceName).
-> SQL Server Express uses the name SQLEXPRESS as the instance name instead of MSSQLSERVER so make sure you are entering correct default name.
-> Check if SQL Server browser service running or not (start the service if not running).
-> Check if SQL Server is set to allow remote connections or not. (Enable it)
-> Run SQL Server as Administrator or try to connect with Run as different user if access is assigned to your login.
-> Check the server connectivity with PING request from client system.
-> Check the port and make sure you are able to TELNET for port connectivity.
-> Add SQL port in firewall exception list.
-> Allow sqlservr.exe and SqlBrowser.exe in windows firewall app settings.
-> Check if TCP/IP is enabled or not in SSCM. (Enable it)
-> In SQL Server Surface Area Configuration, enable local and remote connections.
-> Include Server IP address & SQL port and services in antivirus exception list (eg. sqlservr.exe / SqlBrowser.exe etc.).
If you have any other points please share with us to resolve this issue.
Reference: Manzoor Siddiqui [www.SQLServerLog.com]