4

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!

David Rogers
  • 83
  • 2
  • 6

1 Answers1

3

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

John Glenn
  • 1,469
  • 8
  • 13
  • A good idea, but no, the "Encrypt connection" is not checked. "Trust server certificate" is checked, but other than that, my screen has the same options for "Connection Properties." – David Rogers Jan 21 '22 at 19:25
  • @DavidRogers - Well, darn. Would you care to post screenshots of the rest of the settings panels in the connection dialog? – John Glenn Jan 21 '22 at 19:41
  • Nothing is entered/checked in "Always Encrypted" and "Additional Connection Parameters". – David Rogers Jan 21 '22 at 19:58