Connecting DataGrip to SQL Server Express LocalDB

UPDATED: September, 2019

Check the LocalDB instance

You can easily connect to your LocalDB instance with DataGrip. 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 runningSqllocalDB.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

Important! By default, every LocalDB instance is stopped after several minutes of inactivity. You can change this behavior by changing user instance timeout option with T-SQL (read more at stackoverflow.com). Since DataGrip 2019.2, when IDE connects to LocalDB, the LocalDB instance is started automatically.

Create the Microsoft SQL Server data source

The instance is ready, you can launch DataGrip.

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

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

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

Your DataGrip Team
The Drive to Develop


Comments below can no longer be edited.

7 Responses to Connecting DataGrip to SQL Server Express LocalDB

  1. Avatar

    Justin says:

    January 31, 2017

    Thank you!!! 😀
    I <3 JetBrains

  2. Avatar

    István Heckl says:

    February 17, 2018

    Your description worked fine. But the opened DB contains system tables like spt_monitor, spt_fallback_dev. (sqllocaldb.exe showed only one local db)

    I have an mdf file which contains the DB I want to use. Any idea? (I tried to give the full name of the mdf file in the uppermost Database field, but it did not help)

    • Avatar

      Maksim Sobolevskiy says:

      February 19, 2018

      Let me copy-paste your comment from SO to help those who will read it in future.

      “I found the solution:

      after giving username and password go to schema tab (exit from visual studio) check the mdf file, check the relevent schema, e.g. dbo if you missed this step then database double click on “connection / schemas” to make the check”

  3. Avatar

    Raphael Foxik says:

    June 2, 2019


    There is no SQL Server (jTds) on the list anymore. Anyways I am trying to configure data source for my MSSQLLocalDB. Is there any way to do that in DataGrip/Rider 2019.1? I would appreciate any instructions.

    • Avatar

      Maksim Sobolevskiy says:

      June 3, 2019

      Please attach a screenshot.

      • Avatar

        JimF says:

        August 29, 2019

        I have the same problem, the only choice to create a data source that matches is “SQL Server”. Then, once I select that, I see a second list, and that list has “SQL Server (jTds)”. When I select that, the screen I see on the right does not match your screenshot at all. There is no dropdown for URL, for example.

        Is there an updated blog post for doing this?

Discover more