RubyMine 2017.1 Help

Running SQL Script Files

You can run an SQL file as a whole. You can also execute individual statements contained in an SQL file.

Running an SQL file

When running an SQL script file as a whole:

  • You don't need to open the file in the editor. You can select the necessary file in the Project tool window.
  • You can run the file for more than one data source at once.

On the other hand:

  • The statements with parameters won't run.
  • Retrieved data for the SELECT statements won't be shown.

To run an SQL file:

  1. Select the necessary SQL file in the Project tool window, or open the file in the editor.
  2. Do one of the following:
    • Select Run "<file_name>" from the context menu.
    • Press Ctrl+Shift+F10.
  3. In the Choose Data Source pop-up, click the data source to which the script should be applied.

    If you want to run the script for more than one data source, select the data sources of interest in the pop-up and press Enter.

    /help/img/idea/2017.1/RunSQLScriptSelectDS.png

Executing individual statements

When running individual statements contained in an SQL file:

  • The statements can contain parameters. Prior to running such statements RubyMine will ask you to specify the parameter values.

On the other hand:

  • The statements are run for only one data source at a time.

To run a statement or statements:

  1. Open the SQL file of interest in the editor.
  2. Place the cursor within the statement you want to execute.

    If you want to run more than one statement, select (highlight) the necessary statements.

  3. Do one of the following:
    • Press Ctrl+Enter or select Execute from the context menu.
    • Press Alt+Enter or click /help/img/idea/2017.1/intentionBulb.png, and select Run query in console.
  4. Select the database console to be used.
    /help/img/idea/2017.1/DBSQLAltEnterChooseConsole.png

    The statement or statements are executed using the selected console. The corresponding console is associated with the file. The name of the associated console is shown in the right-hand part of the toolbar.

    /help/img/idea/2017.1/DBConsoleAttached.png

    The menu for the console name, lets you associate a different console with the file, or remove the association between the file and the console (<Detach Console>).

    /help/img/idea/2017.1/DBConsoleMenu.png

See Also

Language and Framework-Specific Guidelines:

Last modified: 18 July 2017