CLion 2024.3 Help

File management

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.

To run your statements and keep track of your code ideas, use the Database Tools and SQL plugin's special file types. You can also work with the files that you store on your machine, and edit the DDL of database objects in the CLion internal files.

  • Query or database consoles are SQL files that are attached to a particular data source. When you create a data source, a query console is created automatically. But you can add more consoles to a data source, each of them will then create a new connection. If you do not want to create new connections, enable single session mode. Consoles are not included in the project context. For more information about query consoles, refer to Query consoles.

  • Scratch files are similar to query consoles, but they are not attached to a data source. We refer to scratch files as temporary notes or drafts for code ideas. Usually, scratch files are outside of the project context. But you can associate an SQL scratch file with a data source and use it as an SQL editor. For more information about scratch files, refer to Scratch files.

  • User files are SQL scripts that you store on your computer or on a server. For more information about working with directories and user files, refer to User files.

  • Object editors are internal files where you edit the DDL of a procedure, a view, a function, or other objects.

Context

Functionality

Query consoles

Executable SQL files that are attached to a specific data source.

  • Files that you can use to compose and execute SQL statements in the project context.

  • Console files are attached to a data source.

  • Default resolve mode is Playground.

Scratches

Files that are not attached to a specific data source.

  • Temporary notes or drafts for your code outside the project context.

  • By default, scratch files are not attached to a data source.

  • Default resolve mode is Script.

User files

Files that are stored on your machine.

  • Can be opened from different projects.

  • Can be put under Version Control.

  • By default, user files are not attached to a data source.

  • Default resolve mode is Script.

Locate SQL files

Find your SQL files in the Project tool window ( View | Tool Windows | Project) .

  • For query consoles, navigate to Scratches and Consoles | Database Consoles.

  • Find scratch files under Scratches and Consoles | Scratches.

Consider the following figure that shows locations of the elements.

Location of files
  1. Directories with user files.

  2. Console files.

  3. Scratch files.

  4. Query console file tab.

  5. Scratch file tab.

  6. Resolve mode.

  7. Schema selected in the <schema> list.

  8. The session selected in the <session list, to which the current SQL file is attached.

Last modified: 11 November 2024