Installation of SQL Server Express LocalDB 2017

clip art of 
 a double-quote character

Question

I want to install Microsoft SQL Server LocalDB 2017 on my system. I downloaded SQL Server Express Setup (about 5.1 MB). Then I opened it and chose ‘Download Media’ option and then chose LocalDB. Then it downloaded SqlLocalDB.msi setup (about 45.9 MB). I ran the setup and installed it on my computer. I don’t know what to do next. Can someone help me, please?

Output of Running "SqlLocalDb info" command:

C:\WINDOWS\system32> sqllocaldb info "MyInstance"
Name:               MyInstance
Version:            14.0.1000.169
Shared name:
Owner:              XXXXX
Auto-create:        No
State:              Stopped
Last start time:    05-11-2018 04:07:11 PM
Instance pipe name:

asked 2018-11-04 by Sam


Answer

LocalDB is a quirky flavor of SQL Server. In most cases, unless there’s specific functionality in LocalDB that you need, I’d suggest running the “regular” Express Edition–as you can avoid quirks like the one you’re running into. Additional details of differences are included in this article.

LocalDB has an “automatic” instance that is tied to current user. To connect to that instance, you would use a connection string like "Server=(localdb)\MSSQLLocalDB;Integrated Security=true".

You can also create an explicitly named instance using the SQLLocalDB.exe command line utility. Depending on your installed version, the path may vary (in this example, 130 is SQL Server 2016, but you would use 140 for 2017, etc):

C:\> cd "C:\Program Files\Microsoft SQL Server\130\Tools\Binn"
C:\> SqlLocalDB.exe create MyLocalDB
C:\> SqlLocalDB.exe start MyLocalDB

The SQLLocalDB info command can be used at any time to determine the state of an instance, whether it is running or not:

C:\> SqlLocalDB.exe info MyLocalDB

Additional info on creating & connecting to a LocalDB instance can be found on learn.microsoft.com.

answered 2018-11-04 by Andy Mallon