RubyMine 2018.3 Help

Working with Database Consoles


Database consoles let you compose and execute SQL statements for databases defined in RubyMine as data sources. They also let you analyze and modify the retrieved data.

The following standardized and DBMS vendor-specific SQL dialects are supported: DB2, Derby, H2, HSQLDB, MySQL, Oracle, Oracle SQL*Plus, PostgreSQL, SQL Server, SQL92, SQLite, and Sybase.

One database console is created for a data source automatically when a data source is created. If necessary, you can create additional consoles.

Database consoles are persistent: they are stored as SQL files.

A database console created in one of your projects can then be accessed from any other project.

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.

Modify console settings

  1. Open a console.

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

    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.

    Closing a console

    1. Click icons actions close (Ctrl+Shift+F4) to close the Database Console tool window.

    2. Click icons actions close on the editor tab (Ctrl+F4) to close the input pane.

    Managing database consoles

    To manage your database consoles, use the Scratches and Consoles directory of the Project tool window.

    To open the list of consoles, select Scratches from the list in the left-hand part of the title bar.


    The directory contains the existing database consoles (represented by SQL files) grouped by your data sources (shown as folders). The default consoles (the ones that were created by RubyMine automatically) have the same names as the corresponding data sources.


    You can:

    • Create new consoles. Select the target data source or a node within it, and do one of the following:
      • Select File | New | Console File from the main menu.

      • Select New | Console File from the context menu

      • Press Alt+Insert and select Console File.

    • Rename your consoles. When a new console is created, it has the name of the data source with a number at the end, e.g. MySQL_1. If you want to give a console a more descriptive name, select the console and do one of the following:
      • Select Refactor | Rename from the main or the context menu.

      • PressShift+F6.

      Then, specify a new name in the dialog that opens.

    • Save your console files in arbitrary directories. Select the console and then choose Refactor | Copy (F5). Specify the file name and location in the dialog that opens.

    • Group your consoles. This is done by creating folders and then dragging your consoles into those folders.

    • Open your consoles. Select the consoles of interest and do one of the following:
      • Select View | Jump to Source from the main menu.

      • Select Jump to Source from the context menu.

      • PressF4.

    • View the history of changes for your consoles. Select File | Local History | Show History from the main menu or Local History | Show History from the context menu.

    • Delete individual consoles and groups of consoles. Use Edit | Delete, Delete from the context menu or Delete on the keyboard.

    Last modified: 10 January 2019

    See Also