Friday, January 18, 2013

Cannot connect to local SQL Server Express 2008 R2

Some times while using SQL server R2 on local machines we get a connection error something looking like

TITLE: Connect to Server
Cannot connect to (local).
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: 2)

To deal with it, there are two things we need to check
  1. Try this as your server: .\SQLEXPRESS
  2. This error occurs if SQLEXPRESS instance is not started. To verify the service is started or not run services.msc and look for  "SQL Server (SQLEXPRESS)" service, status should be "Started", if it is not, try to start it manually.
Submit this story to DotNetKicks