How do I connect to SQL Server 2017 LocalDB?

13,660

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.

Share:
13,660

Related videos on Youtube

kspearrin
Author by

kspearrin

Updated on June 04, 2022

Comments

  • kspearrin
    kspearrin almost 2 years

    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).

  • kspearrin
    kspearrin about 6 years
    You do not provide any of that information when installing localdb.
  • JaYdipD
    JaYdipD about 6 years
    find out the instance name from services on your computer and then use it
  • kspearrin
    kspearrin about 6 years
    Hmm. sqllocaldb info only shows MSSQLLocalDB and ProjectsV13, the two I have already tried. Do I have to start some service after installing LocalDB? I can't find one.
  • Bradley Uffner
    Bradley Uffner about 6 years
    No, you shouldn't have to start anything. It's possible that you don't have an instance with 2017, in which case you can easily create one from the command line with sqllocaldb create <name of new instance>. This will create an instance with the highest available version, though there are options to use older versions.
  • kspearrin
    kspearrin about 6 years
    That did it. Thanks!