Hello! In this tutorial we will look at several popular scripts.
- Copy data source within one project.- A common source of data for different projects within one IDE.- Copy the data source to another IDE, to another computer, to another galaxy.Copy data source within one project
Everything is simple: in the context menu there is a
Duplicate item
. Shortcut: Ctrl / Cmd + D.

')
The password will have to enter again.
Shared data source for different projects within the same IDE
The data source can be made
global; such a data source is “visible” from any project you work with in this IDE. Global data sources are not visible from another version of the same IDE.

Of course, the data source can be made back local.

Copy the data source to another IDE, to another computer.
If the data source is global, you can transfer it by
exporting settings . But you don’t always want to transfer all the settings, and the data sources are not always global either :)
So it will be useful to know that the data source can be copied: in the context menu, select
Database tools → Copy data source to clipboard . It will work with several at once.

This clipboard gets this XML:

Now click
+ on the toolbar and select
Import from clipboard . From XML in the clipboard you get the same data source, but without a password. XML from the clipboard can be sent to colleagues in instant messengers or by mail.

Passwords are stored in KeePass, if you are on Windows and in native storage on Linux and MacOS. You can enable KeePass for any operating system in
Settings / Preferences → Appearance and System Settings → Passwords .

If for some reason the described does not solve your problems, go deeper.
As in our other IDEs, in DataGrip you work in the context of a project. A project is not the most obvious entity when working with SQL, so by default in DataGrip you work in the default project and probably don’t know anything about projects at all if you haven’t created them intentionally.
Here is where this project lies:
Windows<SYSTEM DRIVE>\Users\<USER ACCOUNT NAME>\.<PRODUCT><VERSION>\config\projects\default
Linux~/.config/projects/default
for example, / home / john.
MacOS~/Library/Preferences/projects
In IntelliJ IDEA, PyCharm and other IDEs, local data sources are also attached to the project. Information about them is stored in the file
<PROJECT><NAME>\.idea\dataSources.xml
Do what you want here: copy the entire file, make changes directly to it, or put it under VCS.
If the data source is global, it will not be in this file. For XML with global data sources, look in the options folder at the same level as the projects folder.
Hope was helpful!
DataGrip command.