1

I installed Visual Studio 2019 and created a project and used my local database with Data Source=(LocalDb)\MSSQLLocalDB and everything is correct, but when I want to connect to SQL Server in Navicat or any external software I can't.

I installed the Native SQL Client according to recommended this post: Connecting to LocalDB Server in Navicat Premium

but I get an error when I try to connect:

http://s8.picofile.com/file/8357278576/Untitled.png

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Sina Razavi
  • 45
  • 3
  • 9
  • 1
    `LocalDB` is a developer-optimized version of SQL Server Express. Unlike SQL Server Express, it is **not** installed as a Windows Service that's always available - it's loaded "on-demand", e.g. from VS when the app starts running. So if you really want to use `LocalDB`, you must **manually** start it before trying to connect to it, using the `sqllocaldb` command line tool. **OR** install SQL Server **Express** (which is totally FREE) - this is up and running when you start Windows – marc_s Apr 13 '19 at 05:59

1 Answers1

0

I ever got this problem before, then made that working by taking Instance pipe name of SQL Server localdb instance as the Host of Navicat connection profile.

In long words:

Launch windows command prompt as administrator, run below command to check out Instance pipe name of SQL Server localdb instance(e.g. for instance MSSQLLocalDB):

sqllocaldb i MSSQLLocalDB

This outputs:

C:\Users\Administrator>sqllocaldb i MSSQLLocalDB
Name:               MSSQLLocalDB
Version:            13.1.4001.0
Shared name:
Owner:              ***\Administrator
Auto-create:        Yes
State:              Running
Last start time:    2020/7/1 22:06:21
Instance pipe name: np:\\.\pipe\LOCALDB#C2923FEA\tsql\query

Here np:\.\pipe\LOCALDB#C2923FEA\tsql\query is the Instance pipe name, fill it to the Host field of Navicat connection profile, and fill other fields as I want. Then it worked for me.

Of cause you should start the SQL Server localdb instance at first, it won't be started by Navicat automatically. Here is the command as someone needs.

sqllocaldb s MSSQLLocalDB

And, Instance pipe name will change on localdb instance restarting, you should keep Navicat connection profile updated.

Fengtao Ding
  • 706
  • 8
  • 17