IntelliJ IDEA 14.0.0 Web Help

Running SQL scripts

There is a number of ways to run SQL scripts (i.e. the statements in SQL files). So you can always choose the way that suits you best.

Running an SQL script without opening the database console

  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.

    RunSQLScriptSelectDS

Running SQL statements by means of an intention action

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

    If you want to run more than one statement, select (highlight) the necessary statements. Note that for the intention action to be available, the cursor, as a result, must be within a statement (rather than between the statements).

  3. Do one of the following:
    • Press Alt+Enter.
    • Click intentionBulb.
  4. Select Run Query in Console.
    DBSQLAltEnter
  5. Select the console to be used (i.e. the data source for which you want to run the statement or statements).
    DBSQLAltEnterChooseConsole

Running SQL statements as in the database console

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

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

  3. Press Ctrl+Enter.
  4. Select the console to be used (i.e. the data source for which you want to run the statement or statements).
    DBSQLCtrlEnterFirst

See Also

Language and Framework-Specific Guidelines:

Web Resources:

Last modified: 12 November 2014
comments powered by Disqus