How do I connect to SQL Server 2017 LocalDB?
Asked Answered
M

2

11

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

Messenia answered 23/3, 2018 at 21:33 Comment(0)
W
11

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.

Whelan answered 23/3, 2018 at 22:7 Comment(3)
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.Messenia
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.Whelan
That did it. Thanks!Messenia
W
-1

With SSMS, you should be able to connect to 2017 installation with its instance name, user id and password, that you used during installation of SQL Server 2017

or see this post

SQL Server: How to find all localdb instance names

Willock answered 23/3, 2018 at 21:59 Comment(2)
You do not provide any of that information when installing localdb.Messenia
find out the instance name from services on your computer and then use itWillock

© 2022 - 2024 — McMap. All rights reserved.