Share a LocalDB instance with other users on the computer

MS LocalDB has the possibility to share your personal LocalDB instance with other users on the computer.

You can use the CLI tool SqlLocalDb.exe to share the instance. It is available in the Developer Command Prompt of Visual Studio.

This is the documentation of the share action:

share|h ["owner SID or account"] "private name" "shared name"
    Shares the specified private instance using the specified shared name.
    If the user SID or account name is omitted, it defaults to current user.

Usage:

C:\Windows\System32>sqllocaldb share contosolab\doering MSSQLLocalDB ShareLocalDb
Private LocalDB instance "MSSQLLocalDB" (owner: CONTOSOLAB\doering) shared with the shared name: "ShareLocalDb".

Important: the argument “owner SID or account” must be your own user not the user you want to share the instance with.

The instance then appears as .\ShareLocalDb in the list.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional>sqllocaldb info
.\ShareLocalDb
MSSQLLocalDB

You can use the shared instance in connection strings like this:

Data Source=(LocalDb)\.\ShareLocalDb;database=MyDatabase;trusted_connection=yes;

 

Using Visual Studio Code behind a proxy

Microsoft has built a new lightweight IDE Visual Studio Code. Actually VS Code has nothing in common with their traditional full-featured IDE Visual Studio. It’s more like an enhanced Code Editor like the Atom Editor or vim. VS Code is developed with pure JavaScript and it’s based an Electron (UI-Framework) and Node.js.

If you’re using VS Code from within a companies network und you probably may want to install plugins from the Internet, you have to set the proxy settings first. Because VS Code is built for cross-plattform-ability it isn’t aware of the Windows IE proxy settings.

Please open File -> Preferences -> Settings

Add these two lines to the settings.json:

// Place your settings in this file to overwrite the default settings
{
    "http.proxy": "https://proxy.contoso.com",
    "http.proxyStrictSSL": false
}