Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2022 can connect to localdb but SSMS 18.10 can't

Spanking brand-new installations of:

  • Visual Studio 2022 Community (VS)
  • SQL Server 2019 Dev (SQL)
  • SQL Server Management Studio v18.10 (SSMS)

There are no other Visual Studio or SQL Server instances or installations.

A console program creates a localdb database using Entity Framework successfully. VS SQL Server Object Explorer documents this with a connection to (localdb)\MSSQLLocalDB using a connection string of:

Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=master;
    Integrated Security=True;Connect Timeout=30;Encrypt=False;
    TrustServerCertificate=False;ApplicationIntent=ReadWrite;
    MultiSubnetFailover=False

But I can't get SSMS to connect to this localdb database instance.

I am trying to use this server name:

(localdb)\MSSQLLocalDB

What am I doing wrong? I get an immediate (2 second) response with:

The instance of SQL Server you attempted to connect to does not support encryption. (.Net SqlClient Data Provider)

I used sqllocaldb, and everything looks ok:

sqllocaldb info
MSSQLLocalDB
ProjectModels

sqllocaldb info MSSQLLocalDB
Name:               MSSQLLocalDB
Version:            15.0.4153.1
Shared name:
Owner:              GreenMachine\jean
Auto-create:        Yes
State:              Running
Last start time:    1/21/2022 11:38:11 AM
Instance pipe name: np:\\.\pipe\LOCALDB#878B8E4E\tsql\query 

So I tried another tack. I pointed my EF connection string to the local SQL Server instance:

 optionsBuilder.UseSqlServer("Data source = GreenMachine; Initial 
 Catalog=SamuraiAppData; Integrated Security=True; 
 TrustServerCertificate=True;")

And that worked - I got a new database created on that instance. It seems like SSMS can't connect to localdb!

Thanks for your ideas!

like image 845
David Rogers Avatar asked Sep 05 '25 03:09

David Rogers


1 Answers

From the SSMS connection dialog, click the Options button in the lower right corner to expand the connection options. Ensure that Encrypt Connection is not checked.

enter image description here

like image 166
John Glenn Avatar answered Sep 12 '25 05:09

John Glenn