How to copy data sources to an IntelliJ platform IDE

    Hello! This tutorial will cover some popular scenarios.

    - Copying a data source within one project.
    - A common data source for different projects within the same IDE.
    - Copying a data source to another IDE, to another computer, to another galaxy.

    Copying a data source within one project


    Everything is simple here: there is a Duplicate item in the context menu . Keyboard shortcut: Ctrl / Cmd + D.

    image

    The password will have to be re-entered.

    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 that you work with in this IDE. Global data sources are not visible from another version of the same IDE.

    image

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

    image

    Copy a data source to another IDE, to another computer.


    If the data source is global, you can transfer it by exporting settings . But I don’t always want to transfer all the settings, and the data sources are global not always :)

    So it’s useful to know that the data source can be copied: in the context menu, select Database tools → Copy data source to clipboard . This will work with several at once.

    image

    The following XML gets to the clipboard:

    image

    Now click + on the toolbar and select Import from clipboard . From the 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.

    image

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

    image

    If for some reason the described does not solve your problems, let's go deeper.

    As with 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 if you didn’t create them intentionally.

    This is where this project lies:

    Windows Linux ~ is an alias for the home directory, for example, / home / john. MacOS
    \Users\\.\config\projects\default


    ~/.config/projects/default



    ~/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 a file. \.idea\dataSources.xml

    Do what you want: 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. Look for XML with global data sources in the options folder at the same level as the projects folder.

    Hope it was helpful!

    DataGrip Team

    Also popular now: