CLion 2025.1 Help

Data sources

Enable the Database Tools and SQL plugin

This functionality relies on the Database Tools and SQL plugin, which is bundled and enabled in CLion by default. If the relevant features are not available, make sure that you did not disable the plugin.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Installed tab, find the Database Tools and SQL plugin, and select the checkbox next to the plugin name.

Data source is a connection configuration. It stores a list of connection details that are used to establish connection to a database. For example, host, port, database name, driver, SSH and SSL configuration settings, and so on. In data source settings, you can also select databases and schemas for introspection and display in Database tool window, and change the driver for your connection.

You can configure your data sources in the Data Sources and Drivers dialog ( Shift+Enter) . To access the dialog, in the Database tool window (View | Tool Windows | Database) , click the Data Source Properties button Data Sources on the toolbar.

Data source with connection details for a PostgreSQL database

You can view the list of created data sources and explore them in the Database tool window (View | Tool Windows | Database) .

Data sources in Database tool window

In CLion project, settings of all data sources are stored in the dataSources.xml file located in the project directory under the .idea subdirectory.

In CLion, you can create the following data sources:

  • Database data sources: connection configurations for the operational databases that contain data.

    For different databases, CLion provides complete support and basic support. Complete support of a database includes such features as enhanced code completion and better retrieval of database objects (introspection). All the inspections, quick-fixes, and other coding assistance features are also available, whereas basic support has limited features available.

    For more information on the support types, refer to the Other databases topic.

  • Data Definition Language (DDL) data sources: SQL files that contain data definition language statements (refer to DDL data sources).

Create a data source

To connect to a database and start working with it, create a data source that will contain the connection details and specify those details for the database that you are connecting to.

Supported databases

CLion can connect to databases running locally or remotely, whether on host servers or cloud platforms.

To create a data source and run a test connection to your database, follow the instructions provided in a dedicated topic.

Complete support

The IDE provides complete support for the following databases:

Basic support

For the databases listed below, basic support is provided:

  • AWS Athena

  • Apache Ignite

  • Apache Spark

  • Databricks

  • Denodo

  • DuckDB

  • Elasticsearch

  • Firebird

  • Google Cloud Spanner

  • Informix

  • InterSystems IRIS

  • Mimer SQL

  • OpenEdge

  • Phoenix

  • Presto

  • SAP HANA

  • SingleStore

  • Tarantool

  • Teradata

  • TiDB

  • Tibero

  • Trino

  • YugabyteDB

DDL data sources

To create a DDL data source, follow the instructions from the DDL data sources topic.

Cloud databases

CLion also supports the following cloud databases:

Make a copy of a data source

Duplicating a data source preserves all the connection settings, including the password. A data source can only be duplicated within a single project.

  1. You can duplicate the connection configuration either in Database tool window or in the Data Sources and Drivers:

    • In Database tool window, select the data source you want to duplicate, right-click it and select Copy/Paste | Duplicate.

      Duplicate your data source in Database tool window
    • In the left area of the Data Sources and Drivers dialog ( Shift+Enter) , select the data source you want to duplicate and click the Duplicate icon Duplicate on the toolbar.

      Duplicate your data source in the Data Source and Drivers dialig

    Alternatively, select the data source and press Ctrl+D.

    CLion will create a new data source with the same settings, including the password.

  2. Click OK to save your new data source and close the dialog.

Duplicated data source in the Data Source and Drivers dialig

Delete a data source

You can delete a data source in one of the following ways:

  • To delete the data source using its context menu, in the Database tool window (View | Tool Windows | Database) , right-click the data source that you want to delete and select Delete Data Source.

  • To delete a data source in the Data Sources and Drivers dialog, follow these steps:

    1. Open data source properties by doing one of the following:

      • On the Database tool window toolbar, click The Data Sources icon Data Sources.

      • Press Shift+Enter.

      Open the Data Source and Drivers dialog
    2. In the left pane of the dialog, select the data source that you want to delete and click Remove on the toolbar.

  • To delete a data source in the Data Sources and Drivers dialog via its context menu, in the left pane of the dialog, right-click the data source that you want to delete and select Remove.

Configure display options for data sources

You can group, assign a color, and filter objects in the Database tool window (View | Tool Windows | Database).

Customize the view of objects in the Database tool window

  • To group, enable, or sort data sources, click the View Options icon View Options on the Database tool window toolbar and select the necessary options.

    In the Database tool window, the view of database objects tree changes instantly.

    For more information about the database tree view options, refer to View Options.

    View Options menu items in Database tool window

Group data sources in folders

  • In the Database tool window, select the necessary data source and press F6. Alternatively, right-click a data source and select Move to Folder.

    • If you do not have any folders, you will see the New Folder dialog. In the text field, type the folder name. You can use a forward slash (/) to define nesting. For example, the QA/Quick name will create the Quick folder inside the QA folder.

      Create a new folder to group data sources
    • If you have folders with grouped data sources, you will see the Move to Folder dialog. To create a new folder, select New Folder. To remove a data source from the folder, select Root folder.

      Move a data source to a folder

    Also, you can use Ctrl+C, Ctrl+V, and Ctrl+X to copy, paste, and cut your data sources between folders. If you cut and paste a data source inside one project, it will be moved. No password is required. But the password is required in all the other cases. The cut operation can be undone by using Ctrl+Z.

Assign a color to a data source

To have better differentiation between production and test databases, you can assign a color to a data source.

You can so it either by using data source's settings dialog or its context menu.

  • Settings dialog

    1. In Data Sources and Drivers dialog ( Shift+Enter) , select the data source for which you want to assign a color.

    2. Click the circle in the Name field to select a color.

    3. Apply the changes and close the dialog.

    Assign a color to a data source
  • Context menu

    1. In Database tool window, right-click the data source and navigate to Tools | Set Color.

    2. In Color, select the color that you want to assign.

    3. Apply the changes and close the dialog.

    Assigning a color to a data source

Assign a color to query consoles and grids

The code editor and data editor tabs can use the color of the data source.

  1. To apply the data source color for query consoles and grids, right-click a data source and select Tools | Set Color.

  2. In the Database Color Settings dialog, select the In console editors and grids checkbox.

  3. Apply the changes and close the dialog.

For more information about the dialog and options, refer to Database Color Settings Dialog

Assigning a color to a data source

For more information about about the appearance settings in the dialog, refer to Database Color Settings Dialog.

Filter objects from the toolbar

  • To select the necessary objects, click the View Options icon View Options on the Database tool window toolbar and select the Filter icon Filter. From the database object list, select and deselect the items to toggle visibility of the objects.

Show comments for data sources and database objects

  • To enable comments for databases and tables, click the View Options icon View Options on the Database tool window toolbar and select Comments.

    To add comments for tables, select a table and press Ctrl+F6. In the Comment text field, add a table description.

    To add comments for a database, open database settings Ctrl+Alt+S and add a database description in the Comment text field.

    Show comments for databases and tables

Use full names of data sources

By default, the Shorten Tab Titles option is enabled. A data source name in the tab title is shortened to 36 characters.

  • Right-click a tab of a query console and select Shorten Tab Titles.

View the contents of a node in the Database tool window

  • In the Database tool window, click a node that groups database objects, and press F4.

    View the contents of a node

Share data sources

In CLion, you can share data sources between different projects within a single IDE instance and also between different IDE instances. To share data sources between projects, you have to change their accessibility level. To share data sources between IDEs, you have to either copy and paste them or use the IDE settings export and import features.

Share data sources between projects

Data sources in CLion 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. In the Database tool window, click the Data Source Properties button Data Source Properties on the toolbar.

  2. In the Data Sources and Drivers dialog ( Shift+Enter) that opens, select the data source you want to make global, right-click it and select the Make Global icon Make Global.

    Alternatively, click the Make Global icon Make Global on the toolbar.

    Make a data source global in the Data Source and Drivers dialog
  3. Click OK to save your changes and close the dialog.

To make a data source local again, click the Move to Project icon Move to Project that replaces the Make Global icon Make Global for the data source.

Global and project level data sources in the Data Source and Drivers dialog

Share data sources between IDE instances

In CLion, you can share data sources by either copying their settings to clipboard or using the XML file that includes settings for all the project data sources. Also, you can export and import the file using the IDE settings export and import features.

The reason is that CLion does not have its own password store. It either uses the native password management system or KeePass. To change the way your IDE stores passwords, in IDE settings Ctrl+Alt+S, navigate to Appearance & Behavior | System Settings | Passwords. For more information about storing passwords in CLion, refer to the Passwords topic.

Copy data sources to clipboard

In CLion, you can copy a data source to the clipboard. When you do this, the IDE copies the connection settings as an XML snippet. You can paste the snippet to another IDE and create a copy of your original data source there.

  1. In the Database tool window, select the data source you want to copy.

  2. Right-click the selected data source and navigate to Copy/Paste | Copy Data Source to copy your data source to the clipboard. Alternatively, press Ctrl+C.

    CLion copies the XML snippet with connection settings.

  3. Switch to the target IDE or send the data source to another user.

  4. In the target IDE, open Database tool window.

  5. In the Database tool window, click the New icon New and select Import from Clipboard. Alternatively, right-click the Database tool window and select Copy/Paste | Paste Data Source (or press Ctrl+V).

  6. In the Data Sources and Drivers dialog ( Shift+Enter) dialog that opens, enter the password for the database or schema you are connecting to with this data source.

  7. Click OK to save your new data source and close the dialog.

For every CLion project, there is a dataSources.xml file that stores settings for all data sources of the project. By copying this file, you can share the data sources with another IDE instance. Also, you can store the file under VCS to keep track of changes and to synchronize the data sources list between several users.

The dataSources.xml file is stored under the .idea subdirectory of a dedicated project settings directory in the IDE projects directory.

Locate the dataSources.xml file

  1. In the Project tool window , expand the project directory and .idea directory nodes and locate the dataSources.xml file.

  2. Right-click the dataSources.xml file and select Open In | <file browser>.

Locate the dataSources.xml file

You can also export and import the data source settings file by using the IDE settings export and import feature with the settings.zip file. The settings.zip file includes only data sources that are available at the global level. For more information about changing a level, refer to Change the project level to global.

Export global data source settings to a ZIP archive

  1. Select File | Manage IDE Settings | Export Settings from the main menu.

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

  3. In the Export Settings window, select Database: global data sources.

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

alt_export_sata_sources_settings_zip

Import global data source settings from a ZIP archive

  1. Select File | Manage IDE Settings | Import Settings from the main menu.

  2. In the file browser window, locate the settings.zip file that you exported, and select it.

  3. In the Select Components to Import window, select 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 dialog ( Shift+Enter) , 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.

alt_import_sata_sources_settings_zip

Tips and tricks

Share all the connections with passwords

  1. Open settings by pressing Ctrl+Alt+S and navigate to Appearance & Behavior | System Settings | Passwords.

  2. Select the In KeePass option.

  3. In the Database field, specify a path for the KDBX file in the directory where you store your project.

  4. Copy the whole directory with your project to another computer.

  5. On another computer, open settings by pressing Ctrl+Alt+S and navigate to Appearance & Behavior | System Settings | Passwords.

  6. In the Database field, type a path to the copied KDBX file.

  7. Click File | Open and navigate to the directory with copied project files.

Last modified: 28 May 2025