Recently I have developed software using SQL Server 2012. Now when I try to connect, I get this error message:
Cannot connect to AAFI\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)
Best Answer
This is an extremely common error, with literally millions of search results online. The typical troubleshooting steps include:
sc query sqlbrowser
from the command line (if it is not running, right-click > Start or runnet start sqlbrowser
from the command line).If you are trying to connect to a different machine (or using a name that forces you to route outside of your machine for some reason), make sure the server is configured to allow remote connections. You can fix this by using remote desktop to connect to that server and running this locally:
Of course this might be hard to do if it's the local instance you can't connect to, so you'll have to get connected locally using other steps in this list first before you'll be able to talk to the server to change this setting.
localhost
and127.0.0.1
in addition to the server name. Make sure you cantraceroute/tracert
to the server andtelnet
to the running port. If you can connect to one of these hosts but not others, either change your connection string, change your hosts file and/or DNS, or consult your network administrator.server_name_or_ip\SQLEXPRESS
- a common one asSQLEXPRESS
is typically the instance name in use when running SQL Server Express Edition.A lot of this is documented much more elaborately here (found in Paul White's wiki post here):