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
If database files are in your DataGrip working folder, open the Files tool window. Otherwise, open your file manager.
Open the Database tool window ( ).
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.
If you do not have the necessary database driver files, download them. Click on the toolbar of the Database tool window. Alternatively, select Properties from the context menu.
In the Data Sources and Drivers window, click the Download link.
To ensure that the connection to the data source is successful, click Test Connection, and click OK.
Create a DDL data source
Open the Database tool window ( ).
Click the Data Source Properties icon () on the toolbar, and select DDL Data Source.
Specify the data source name.
In the DDL Files form, click the Add icon () and select necessary SQL files.
Export and import data source settings
Export data source settings
In the Export settings window, click Select None.
In the Export settings window, select Database: drivers, Database: settings, and Database: global sources.
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
In the Import File Location window, locate the settings.zip file that you exported, and double-click it.
In the Select Components to Import window, select Database: drivers, Database: settings, and Database: global sources.
In the Restart Needed window, click OK to restart your IDE.
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.
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.
In the Data sources and drivers window, select the data source that you want to copy.
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.
In the Data sources and drivers window, click 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.
In the Database tool window ( ), select data sources that you want to copy.
Right-click the selection.
Click Database tools and select Copy Data Sources to Clipboard.
On another workstation, click.
In the Database tool window, click the New icon (), select Import from Clipboard.
Customizing data sources
Configure data source settings
In the Database tool window ( ), select a data source that you want to change.
Click the Data Source Properties icon () on the toolbar (or press N/A).
Group data sources
If you have a number of different databases, you can group their data sources in the Database tool window ( ). 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.