PyCharm 2019.3 Help

How to connect to SQL Server Express LocalDB

Step 1. Check the LocalDB instance

You can easily connect to your LocalDB instance with PyCharm. And as a first step, check if your LocalDB instance is ready for a connection. Locate SqllocalDB.exe and run the SqllocalDB.exe i command in a terminal. You will see a list of available LocalDB instances on the server.

Run the SqllocalDB.exe i command

To create an instance, run SqlLocalDB create "DEVELOPMENT" 14.0 -s. This command creates an instance of LocalDB named DEVELOPMENT by using SQL Server 2017 binaries and starts the instance. If you omit 14.0, the version number defaults to the version of the SqlLocalDB utility.

Create a LocalDB instance

We want to connect to the MSSQLLocalDB instance. First, we need to check its state by running SqllocalDB.exe i MSSQLLocalDB command.

Run SqllocalDB.exe i MSSQLLocalDB command

Currently, the instance is running (see the State field). If you have the Stopped state, start the instance by running SqllocalDB.exe s MSSQLLocalDB in the terminal.

Run SqllocalDB.exe s MSSQLLocalDB

Step 2. Create the Microsoft SQL Server data source

The instance is ready, you can launch PyCharm.

In the Database tool window (View | Tool Windows | Database), click the Add icon The Add button and select Microsoft SQL Server.

Add SQL Server (jTds) as a data source

Step 3. Configure the LocalDB connection

Select the driver

From the Driver list, select Microsoft SQL Server (jTds).

Select the driver

Select the connection type

From the Connection type list, select LocalDB.

Select the connection type

Select the LocalDB instance

From the Instance list, select the instance to connect to (for example, MSSQLLocalDB).

Select the LocalDB instance to which you want to connect to

Select the domain

Open the Advanced tab and find the DOMAIN option and set it to the name of the machine where the instance is installed. If the instance is on your local machine, use the name of your computer.

Set the DOMAIN option

Step 4. Enter credentials and test your connection

If you do not use Windows domain authentication, clear the Windows domain authentication checkbox and enter your access credentials. Click Test connection.

Enter credentials for the connection
Last modified: 27 March 2020