Cannot connect to .\SQLEXPRESS.

Max 1 Reputation point
2020-12-08T12:06:34.31+00:00

SQL Express (2012-2014-2017 &^2019) is used for storing data from our testers.

Normally, this works all fine, but recently in 2 occasions a "network-related or instance-specific" error occurred. The databases ran fine and no known changes had been made to the systems.

In one of the cases, a few days/ weeks earlier, the PC was added to the network domain (where SMBv1 was required).
After reinstalling the complete SQL (Express Advanced 2014) software, everything worked normally again, but the error kept reoccuring at random interval. After taking the PC out of the domain, the issue never showed again.

Now the problem showed again on a stand-alone system, which was running fine before. (now the 2019 version is installed to see if this solves the problem)

Is there a known way to prevent this, or would there be another way to fix this except reinstalling the complete software?

===================================

Cannot connect to [PC-Name]\SQLEXPRESS.

===================================

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) (.Net SqlClient Data Provider)


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


Error Number: -1
Severity: 20
State: 0


Program Location:

at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,902 questions
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Erland Sommarskog 102.3K Reputation points
    2020-12-09T22:06:13.417+00:00

    If it is a local instance .\SQLEXPRESS should work.

    A possible reason is that the instance is set as hidden. In SQL Server Configuration Manager, find the node SQL Server Network Configuration. Right-click the instance in the left pane, and select Properties. If Hide Instance has Yes, you may want to change that. Alternatively, start the Browser service. At least it seemed that when I connected with my instance hidden that I could still connect when the Browser service was running.

    I did not come around to try .\INSTANCE when I had my instance hidden, but maybe that works. But when I used COMPUTER\INSTANCE, had the instance hidden and the Browser service stopped, I could not connect.

    1 person found this answer helpful.
    0 comments No comments

  2. CathyJi-MSFT 21,096 Reputation points Microsoft Vendor
    2020-12-10T03:24:25.65+00:00

    Hi @Max ,

    > The SQL Server Browser is normally disabled at our systems, also in this case, as we don't use this for a locally running server.

    Your SQL server instance SQLExpress is named instance, you must to make sure SQL Server browser service is running.

    Please refer to MS document SQL Server Browser service to get more information.

    Best regards.
    Cathy


    If the response is helpful, please click "Accept Answer" and upvote it, thank you.

    1 person found this answer helpful.

  3. Erland Sommarskog 102.3K Reputation points
    2020-12-08T23:16:02.913+00:00

    Your topic says .\SQLEXPRESS but your error message includes a machine name. Are you connecting to a local SQL Server instance or an instance on a remote machine?

    There are many possible reasons for this error of which reinstalling is required solution for very few of them. The simplest reason is that SQL Server is not running. And that is the most likely if this is happening with a local instance. If it is an instance on a different computer, there can be network issues, firewall etc. Also, by default, Express Edition does not listen for remote connections.

    0 comments No comments

  4. CathyJi-MSFT 21,096 Reputation points Microsoft Vendor
    2020-12-09T03:54:03.737+00:00

    Hi @Max ,

    > Cannot connect to .\SQLEXPRESS.

    It seems you try to connect to local SQL server, is it right? If you try to connect to SQL Express on remote server, please using a connection string like server name\SQLExpress to connect to an instance on remote computer, Eg: node3\SQLExpress .

    > SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified

    Please follow below steps to troubleshot the issue,

    1. Make sure SQL Server Service is running
    2. Make sure SQL Server browser service is running. Make sure the server name and instance name is spelled correct.
    3. If this is remote connection, make sure SQL Server is configured to allow remote connections and TCP\IP protocol is enabled.
    4. Examine the SQL Server error log for messages confirming that SQL is listening on the expected network interfaces and ports
    5. Test server connectivity with PING from the client machine
    6. Test port connectivity using TELNET to the server and port (from step 4) from the client machine. For example
      TELNET <server-name> 1433
    7. Check firewall settings if step 5 or 6 connectivity test fails

    If you have some confuse about the steps, please refer to SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified or Troubleshoot connecting to the SQL Server Database Engine to get more information.

    Best regards,
    Cathy


    If the response is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

  5. Max 1 Reputation point
    2020-12-09T15:29:47.953+00:00

    Hello @CathyJi-MSFT & @Erland Sommarskog ,

    First of all, sorry for the mistake in the title. Originally, I had in both cases [PC-Name]\SQLEXPRESS, but the titlebar got copied from one of the search suggestions.
    The issue is about systems that run on a local server, so far we have never had issues with systems that run on centralized servers.

    I understand that reinstalling the system is most likely not required, but as I don't know the short solution, that makes it a long solution because we have to find it first.
    So mostly we let the local support reinstall the software, which normally works just fine.

    To answer some of the questions:
    The services were running, both SQL Server (SQLEXPRESS) & SQL Server Reporting Services were checked and ran normally.
    The SQL Server Browser is normally disabled at our systems, also in this case, as we don't use this for a locally running server.

    The server name and instance were not available in the normal dropdown selection and also in the <Browse for more...>, there was no option available for Local Servers.
    After manually typing the PCname and instance, still no connection was available.

    0 comments No comments