38

I can't seem to figure out how to export a data source configuration in DataGrip (currently on 2016.2 EAP).

I would like to export a handful of data sources and share them with my teammates to make it easier for them to get up and running on DG.

I've tried File->Export Settings (exporting all settings) and did not notice the data source configurations within the resulting jar file.

I seem to recall that in earlier versions of the tool (when it was still called 0xDBE), you could find data source configuration files on the drive and share them that way, but I am unable to locate any at this time.

Perhaps it's not possible?

lospejos
  • 1,888
  • 3
  • 17
  • 31
David Farrell
  • 2,937
  • 2
  • 12
  • 11

6 Answers6

45

UPDATE FROM 2021!

Starting from version 2021.1, you can just press Ctrl/Cmd+C on the data source, and then Ctrl/Cmd+V it in another IDE. The clipboard contains XML for the data source, so you can send it to the colleague via e-mail, messenger etc.


It is possible! You need to share a project with your friend — all you do in DataGrip is in the context of a project. If you did not create a new one, everything is under the default project. Look at the gif:

enter image description here

The more detailed information can be found in the tutorial: https://blog.jetbrains.com/datagrip/2018/05/21/copy-and-share-data-sources-in-datagrip/

moscas
  • 6,378
  • 28
  • 35
  • Thanks @moscas ! I've accepted this answer 1) because it clearly shows how to find the root folder for any project and 2) because it turns out to be the only way I could find to share connections that also shares the login credentials of the connections. I will be adding a follow-up comment with the rest of my findings, but thanks again for replying! – David Farrell Jun 24 '16 at 16:26
  • 1
    This also kind of works for importing the data sources into phpstorm. The datatools in phpstorm have the same feature set as datagrip (according to jetbrains support). Copy over the datasource.xml and datasource.local.xml when phpstrom isn't running. The 'kind of' part is that you will have to reenter any saved passwords. – mushcraft Jul 04 '16 at 08:34
  • 1
    In my case, I wanted to move project level data sources from phpStorm to DataGrip and this worked: `mv` `my-project/.idea/dataSources` `dataSources.*` `~/Library/Preferences/DataGrip2017.2/projects/default/.idea/` – Raghu Dodda Oct 20 '17 at 03:47
  • 1
    Could you write out the instructions? The gif doesn't show everything, takes a long time to go through, and if you miss it you have to wait for another round. Also, it's on a mac. – Justin Jul 11 '18 at 16:41
  • 3
    @Justin yes, sure: https://blog.jetbrains.com/datagrip/2018/05/21/copy-and-share-data-sources-in-datagrip/ – moscas Jul 13 '18 at 09:30
  • for some weird reasons, I have a problem with this method. I am able to copy the existing source and it shows import from clipboard but doesn't do anything when I click the clipboard button. – zinoadidi Jun 16 '20 at 10:54
  • @zinoadidi looks like a bug, please report it: https://youtrack.jetbrains.com/issues/DBE – moscas Jul 20 '20 at 09:28
27

You can do it easily via the clipboard, although it took me a while to figure it out:

  1. in your source project, open the Database tool window, select the data sources you want to export, then right click / "Database Tools..." / "Copy Settings"
  2. in your target project, open Database tool window, click on "+" then "Import from Clipboard"

Also works between DataGrip and IntelliJ.

Addendum The wording has changed slightly in DataGrip 2018.2 EAP (or before), instead of "Copy Settings" it's now "Copy Data Source(s) to Clipboard", which reflects better what it does.

Olivier Gérardin
  • 876
  • 11
  • 22
  • 1
    This is great for when I want to copy a data source between DataGrip projects locally. – David Faivre Aug 21 '17 at 13:25
  • 1
    It is good to know that "Import from Clipboard" button is not visible if your Clipboard is empty. So be sure that you copy the settings before. – Aydinozkan Nov 13 '18 at 13:41
  • 1
    True. The process is still unintuitive, I wish I could just Ctrl-C/Ctrl-V a Datasource from one project to another! – Olivier Gérardin Nov 14 '18 at 13:57
  • Easy, clean solution. Ctrl + Shift + A and search Database to easily open Database sidebar, then hit the "+" and there you will find "Paste Source from Clipboard" – jmojico Mar 31 '21 at 16:44
17

DataGrip stores data sources on two different levels:

  • Project level: together with project configuration files inside .idea subfolder of the project folder
  • IDE level: stored in IDE config/options directory.

Project level data source is available once you open the project.

To import/export IDE level Data Source use File | Import/Export settings action.

To move Data Source to IDE settings and back use corresponding action in Datasource Properties dialog (see screenshot) as shown here: Global / local datasource switch in datagrip

Andrey
  • 10,218
  • 10
  • 57
  • 121
Freiheit
  • 7,407
  • 6
  • 52
  • 95
4

On my current version 2020.1 the projects are on:

 /System/Volumes/Data/Users/tiagogouvea/Library/Application Support/JetBrains/DataGrip2020.1/projects/default/

A good way to find where is it store is just calling:

 find . -name "dataSources.xml"

It will find for that file everywhere.

Tiago Gouvêa
  • 10,575
  • 2
  • 60
  • 69
0

You can find all data sources at this path (change username and version):

C:\Users\fouad.DataGrip2019.1\config\projects\default\.idea

Eng.Fouad
  • 107,075
  • 62
  • 298
  • 390
0

make the data source global and use export settings to export. https://www.jetbrains.com/help/datagrip/managing-data-sources.html#sharing-data-source-settings