0

Forum


You need to log in to create posts and topics.

How to connect to local DB?

How do you connect to the local DB defined in appsettings.json?  I've tried a dozen different approaches in Visual studio to add it as a Data Connection so i could browse the DB, but to no avail.  I can't find it as a file and it doesn't show up as a server either.  Where is the DB actually being stored?

 

Found it, apparently (local) is the same as (localdb) which is stored in c:\users\<username>\

(local)

(local)  appears in appsettings.json which is used during production.

It refers to the "default installation of SQL" on the computer/server. Its the same as .  and NameOfYourComputer .

To add it as Data Connection and browse the DB you would specify (local) , or .  or NameOfYourComputer as the Server name. If your installation of SQL is a named instance then you'll need to include the instance name also as (local)\InstanceName  or .\InstanceName  of NamdOfYourComputer\InstanceName

(localdb)

localdb appears in appsettings.Development.json which is used during development.

It refers to the light weight "SQL Server Express" installation which is used during development. As you pointed out its data files are saved in c:\users\<username>\

To add it as Data Connection and browse the DB you would specify (localdb)\MSSqlLocalDB as the Server name.