Tutorials Uncategorized

Copy and Share Data Sources in IntelliJ-based IDEs



In this tutorial we’re going to look at three popular use-cases:

— Duplicate a data source within one project.
— Share data sources between projects inside one IDE.
— Copy a data source from one IDE to another IDE, or to another computer.

Duplicate a data source within one project

A trivial problem deserves a trivial solution: in the context menu of the selected data source, click Duplicate or press Ctrl/Cmd+D.


A new data source will be created with the same properties, including the password.

Share data sources between projects inside one IDE

In IntelliJ-based IDEs, a data source can be global. This means it becomes visible from all projects you run from a particular IDE. By default, data sources are local. To make a data source global, click the corresponding button in the toolbar (or the context menu).


If you want to make it local again, click the button again.


Global data sources are visible in all projects you open from the same version of the same IDE. Say, if you use DataGrip 2020.1, global data sources will not be visible from projects you open in other versions of DataGrip or in IntelliJ IDEA.

Copy a data source from one IDE to another IDE, or to another computer

Global data sources can be copied via Export Settings. But what if you don’t want to export all settings? And what if you don’t use global data sources?

The first and the most convenient way to copy data sources to another IDE: select the ones you need and in the context menu choose Database tools → Copy data source to clipboard.


In fact, XML is copied to the clipboard like in the following example:


You can send this snippet to your colleague via a messenger, or just import it to another IDE on your machine. To do this, click Add data source (+) → Import from clipboard.


The datasource is copied without a password, so you’ll need to input it manually. DataGrip stores passwords in the KeePass storage on Windows and in native keychains on Linux and MacOS. You can configure the IDE to store passwords in KeePass on any OS: to do this go to Settings/Preferences → Appearance and behavior → System settings → Passwords.


If for some reason that flow doesn’t meet your needs, here comes something for advanced users.

DataGrip, like any other IDE from JetBrains, works in the context of a project. The entity of the project is not a thing that database developers are used to, which is why DataGrip creates a default project once you run the IDE. And you continue using this default project unless you create a new one.

The information on all data sources you have in a project is stored inside the dataSources.xml file inside this project.

Where is this default project located?



~/Library/Application Support/JetBrains/<product><version>/projects

More information about the config folders is here.

If you created other projects than default, we assume you know where they are located. Anyway, if you go to File → Open Recent → Manage projects, you’ll see all projects with their paths except the opened one.

So, if you open a project from another IDE, it will contain all data sources without passwords. They are stored in \.idea\dataSources.xml


If you make any changes to this file, it will affect the data sources you use. It can be even placed under a VCS to synchronize the data sources list between several users.

You might also notice the dataSources.local.xml file where DataGrip stores schema visibility settings and some other information that can vary from user to user. If a data source becomes global, the information about it is stored in the options folder, which is located at the same level as the projects folder.

That’s it. Please comment if you have questions.

Comments below can no longer be edited.

11 Responses to Copy and Share Data Sources in IntelliJ-based IDEs

  1. Avatar

    Anthony Cheng says:

    October 5, 2018

    Looks like “import from clipboard” option is no longer available (2018.2).

    • Avatar

      Maksim Sobolevskiy says:

      October 5, 2018

      Should be! Please, check if anything is in your clipboard actually 🙂

    • Avatar

      Federico Iosue says:

      October 8, 2018

      It just works if your clipboard is filled with correct data from datasource exportation

      • Avatar

        Andrzej Rehmann says:

        October 22, 2019

        The option to paste from clipboard is no longer under the `+` sign but if you right click in the DB menu and select `New` it appears there.

        • Avatar

          Maksim Sobolevskiy says:

          October 28, 2019

          It appears only if you have the data source in the clipboard, please, check

  2. Avatar

    Matt says:

    October 24, 2019

    how can i copy ssh tunnel setting to another datagrip in another laptop ?

  3. Avatar

    Alexander says:

    October 30, 2019

    I use datagrip plugin inside WebStorm, i wonder if IDE settings sync store datagrip’s plugin data sources in Webstorm?

    • Avatar

      Maksim Sobolevskiy says:

      October 31, 2019

      No, if they are not global. So, you can make the needed data sources global (Make Global button in the properties)

  4. Avatar

    Rafał Kotowicz says:

    February 18, 2020

    Location of the dataSources.xml file in Linux is:

  5. Avatar

    Justin Miller says:

    March 18, 2020

    For me using DataGrip on MacOS, I found the files here (some are global, some are local):