SQL Server- a network-related or instance-specific error occurred while establishing a connection to sql server
Error Details or symptoms: Can not connect to a SQL server and you get a error a network-related or instance-specific error occurred while establishing a connection to sql server
This error is seen in SQL Express installation as its installed a named instance by default with name of instance as Servername/SQLExpress.
Some other Errors Similar:
provider: named pipes provider, error: 40 – could not open a connection to sql server which is covered here.
provider: sql network interfaces, error: 26 – error locating server/instance specified which is covered here.
If we are connecting from Windows PC/Client to Windows server/SQL Server (server with SQL Server installed) and are getting the error above then we need to check following:
On Windows SQL Server if we are trying to connect to Named instance then:
Make sure the the Windows service called “SQL Server Browser” is started.
Make sure Windows Firewall is enabled for incoming port UDP 1434
Make sure Windows Firewall is enabled incoming port TCP 1433
Make Sure in SQL Server Configuration Manager that TCP/IP protocol is enabled and is set to to 1433(can be changed if needed)
Additionally, Make sure
Make sure your database engine is configured to accept remote connection. Right click on instance to go to properties page and make sure its enabled to accept remote connections.
If we are connecting to a named SQL Server instance, make sure that instance name in your connection string is right. Usually the format needed to specify the database server is machinename\instancename or in your connection string is right format with right instance name.
More from SQLServerDBA
- SQL Server- Unable to connect to SQL Express Error: 26-Error Locating Server/Instance Specified
- Microsoft SQL Server Error: 53 or Microsoft SQL Server Error: 11001 or SQL Server error 53 and 40. SQL server error 53 and 17
- SQL Server error 40 could not open a connection to sql server 2016
- Microsoft SQL Server Error: SQL SERVER – Msg 102, Level 15, State 1, Line 2 Incorrect syntax near ‘)’ or msg 102 level 15 state 1 line 3 incorrect syntax near ‘ ‘
- Microsoft SQL Server Error: SQL SERVER – Msg 8152, Level 16, State 14 – String or Binary Data Would be Truncated
- SQL Server Error: 17806, Severity: 20, State: 14. SSPI handshake failed with error code 0x8009030c, state 14