title: SQL Server Connection Strings - dot(".") or "(local)" or "(localdb)"
body: <p>I've recently had to install SQL Server and restore a database to 2 laptops, the first took me a couple of days to figure out, the second I'm still struggling on.</p>
  
  <p>On both I was getting this error here:</p>
  
  <blockquote>
    <p>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) </p>
  </blockquote>
  
  <p>I'm still getting it on the second.</p>
  
  <p>I did a lot of research and followed all the steps listed on StackOverflow and other sites such as ensuring SQL Server has TCP and Named Pipes running, ensuring that SQL Server was allowing remote connections, and all other troubleshooting steps I could find.</p>
  
  <p>In the end I discovered that I was just entering the connection string wrong on the first laptop. I was trying to use <code>(localdb)\MSSQLSERVER2012</code> (or something like that) as it says to do on so many sites. It started working when I used <code>.\MSSQLSERVER2012</code>. I thought they would all point to the same place but obviously not.</p>
  
  <p>I really want to avoid this problem again, and figure out how to get my second laptop set up. How do I know if I should be using <code>.\SQLSERVER2012</code>, <code>(local)\SQLSERVER2012</code>, <code>(localdb)\SQLSERVER2012</code>, etc? Is there a simple way of finding this out using a command line tool like <code>SqlLocalDb</code>? And how is this set up in the first place? </p>