DataGrip 2019.1 Help

Managing data sources

Data source is a location of data for your application.

In DataGrip, you can define the following data sources:

  • Database data source: operational databases that contain data (see Connect to a database).

  • Data Definition Language (DDL) files: SQL files that contain data definition language statements (see Add a DDL data source).

Create a data source

Create a DB data source from database files

  1. If database files are in your DataGrip working folder, open the Files tool window. Otherwise, open your file manager.

  2. Open the Database tool window (View | Tool Windows | Database).

  3. Select the files that you want to use as data sources and drag them to the Database tool window. A separate data source is created for each file.

  4. If you do not have the necessary database driver files, download them. Click The Data Source Properties icon on the toolbar of the Database tool window. Alternatively, select Properties from the context menu.

  5. In the Data Sources and Drivers window, click the Download link.

  6. To ensure that the connection to the data source is successful, click Test Connection, and click OK.

Create a DDL data source

  1. Open the Database tool window (View | Tool Windows| Database).

  2. Click the Data Source Properties icon (the Data Source Properties icon) on the toolbar, and select DDL Data Source.

  3. Specify the data source name.

  4. In the DDL Files form, click the Add icon (the Add icon) and select necessary SQL files.

Export and import data source settings

Export data source settings

  1. Click File | Export Settings.

  2. In the Export settings window, click Select None.

  3. In the Export settings window, select Database: drivers, Database: settings, and Database: global sources.

  4. In the Export settings to field, type a path to the folder where you want to store the settings.zip file.

Import data source settings

  1. Click File | Import Settings.

  2. In the Import File Location window, locate the settings.zip file that you exported, and double-click it.

  3. In the Select Components to Import window, select Database: drivers, Database: settings, and Database: global sources.

  4. Click OK.

  5. In the Restart Needed window, click OK to restart your IDE.

  6. Open the Data sources and drivers window, enter necessary connection credentials in the data source properties. If the data source is on a local or network drive, ensure that the path to this data source is correct.

  7. To ensure that the connection to the data source is successful, click Test Connection.

Copy and share data sources

Copy a data source

You may copy a data source if you need to use the same data source in another project, but have different requirements to it, such as its accessibility level (project or global), the user, database connection and schema settings, and so on.

  1. Click File | Data Sources (N/A).

  2. In the Data sources and drivers window, select the data source that you want to copy.

  3. Click the Duplicate icon, or press Ctrl+D.

Share data sources between projects

Data sources in DataGrip are available at two levels: project and global. The project level means that you can access a data source only from the project where this data source was created initially. At the global level, a data source is available for other projects. By default, a data source is available at the project level.

To share a data source between different projects inside your IDE, you need to move the data source to the global level.

  1. Click File | Data Sources.

  2. In the Data sources and drivers window, click the Make Global icon (the Make Global icon) to make the data source available at the global level.

Share data sources between different IDE instances

You can copy information about a data source to the clipboard in the XML format. The resulted XML does not include password information.

You can send the XML snippet to another IDE (in a messenger or by email) and import it.

  1. In the Database tool window (View | Tool Windows | Database), select data sources that you want to copy.

  2. Right-click the selection.

  3. Click Database tools and select Copy Data Sources to Clipboard.

  4. On another workstation, click View | Tool Windows | Database.

  5. In the Database tool window, click the New icon (the New icon), select Import from Clipboard.

Customizing data sources

Configure data source settings

  1. In the Database tool window (View | Tool Windows | Database), select a data source that you want to change.

  2. Click the Data Source Properties icon (the Data Source Properties) on the toolbar (or press N/A).

Configure data source settings

Group data sources

If you have a number of different databases, you can group their data sources in the Database tool window (View | Tool Windows | Database). To group data sources, select the necessary data source, press F6, or select Move to Group from the context menu.

The following options are available for data source groups in the Move to Group menu:

  • Create a new group for the data source.

  • Move the data source to the root list. This option removes the data source from a group.

  • Move the data source to an existing group.

Group data sources
Last modified: 25 July 2019