How do I connect to SQL Server 2017 LocalDB?

kspearrin picture kspearrin · Mar 23, 2018 · Viewed 12.9k times · Source

I've been using (localdb)\ProjectsV13 as part of my VS 2017 installation, however, I recently needed to access some SQL Server 2017 features during development, so I installed SQL Server 2017 LocalDB as well (not part of VS installer still unfortunately). Now I have 2016 and 2017 localdb installed side by side:

enter image description here

How do I connect to this 2017 localdb instance?

Connecting via SSMS, (localdb)\ProjectsV13 and (localdb)\MSSQLLocalDB both still return:

SELECT @@VERSION

Microsoft SQL Server 2016 (SP1) (KB3182545) - 13.0.4001.0 (X64)   Oct 28 2016 18:17:30   Copyright (c) Microsoft Corporation  Express Edition (64-bit) on Windows 10 Pro 6.3 <X64> (Build 16299: ) (Hypervisor) 

(localdb)\ProjectsV14 does not seem to exist (times out when trying to connect).

Answer

Bradley Uffner picture Bradley Uffner · Mar 23, 2018

You can get a list of all instances of LocalDb from the command prompt with the SqlLocalDb.exe program, which is in your PATH by default:

sqllocaldb info

That will list out the available instances. From there you can get additional information about a specific instance with:

sqllocaldb info <instance name>

It will produce output similar to the following:

Name: MSSQLLocalDB
Version: 13.1.4001.0
Shared name:
Owner: DESKTOP-557IFJ5\Bradley Uffner
Auto-create: Yes
State: Stopped
Last start time: 12/4/2017 11:42:58 PM
Instance pipe name:

You should be able to use this information to connect through SQL Server Management Studio.