DataGrip 2018.3 Help

Database consoles

Database consoles are SQL files in which you can compose and execute SQL statements. Unlike scratch files, consoles are attached to a data source. When you create a data source, a database console is created automatically. If necessary, you can create additional consoles.

Create a database console

To create a console, use one of the following actions in the Database tool window (View | Tool Windows | Database).

  • Click a data source and select File | New | Console.

  • Right-click a data source and select New | Console.

  • Click a data source, press Alt+Insert, and select Console.

  • Click a data source, press Ctrl+Shift+F10, and select New console.

Open a console

  • In the Files tool window (View | Tool Windows | Files), navigate to Scratches and Consoles | Database Consoles | < data_source_name>, double-click a console file.

  • In the Database tool window, click the Jump to console icon (runJdbcConsole) and select a console.

  • Click a data source, press F4, and select the console that you need.

Delete a database console

  1. In the Files tool window (View | Tool Windows | Files), navigate to Scratches and Consoles | Database Consoles.

  2. Expand a data source group that includes your console.

  3. Right-click a console file and select Delete.

Modify console settings

  1. Open a console.

  2. Click the Settings icon (icons general settings svg).

    Modify console settings

    Change the SQL dialect in a console

    Right-click the editing area of the input pane, select Change Dialect (<current_dialect>), and select the necessary dialect.

    Disable syntax error highlighting

    Right-click the editing area of the input pane, select Change Dialect (<current_dialect>), and select <Generic SQL>. <Generic SQL> supports completion and highlighting for SQL keywords, table and column names. Syntax error highlighting for this option is disabled (statements in the Editor area are shown as syntactically correct).

    Rename a database console

    1. In the Files tool window (View | Tool Windows | Files), navigate to Scratches and Consoles | Database Consoles.

    2. Expand a data source group that includes your console.

    3. Right-click a console file and select Refactor | Rename.

    Copy a console file to a new location

    1. In the Files tool window (View | Tool Windows | Files), navigate to Scratches and Consoles | Database Consoles.

    2. Expand a data source group that includes your console.

    3. Right-click a console file and select Refactor | Copy.

    4. In the To directory field, specify a new location for the file.

    Group consoles under the data source directory

    1. In the Files tool window (View | Tool Windows | Files), navigate to Scratches and Consoles | Database Consoles.

    2. Right-click a data source group where you want to create a new directory, select New | Directory.

    3. Specify a name of the directory.

    4. Select and drag console files to the directory.

    5. In the Move dialog, click OK.

    View a console log

    1. Open a console.

    2. Right-click the Editor area and select Local History | Show History.

    Last modified: 28 November 2018