RubyMine 6.3.0 Web Help

You can inject SQL statements in your source code and invoke their execution by means of an intention action. If an SQL injection contains parameters, RubyMine detects them when the statement execution is started and prompts you to specify the substitution values.

To run an injected SQL statement
  1. Prepare the desired SQL statement and inject it in the source code.
  2. Position the cursor at the desired SQL injection, press Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt+EnterAlt EnterAlt EnterCommand 1Alt Enter, and choose Run Query in Console on the context menu.
  3. Specify the data source to run the statement against. Do one of the following:
    • If no instances of the Database Console tool window are running, select the target data source in the Choose Data Source pop-up window.
    • If one or more instances of the Database Console are already running, the Choose Console pop-up window opens. In this pop-up window, specify whether you want to run the statement in one of them or open a new instance.
      • To have the statement executed in an already running console, choose the console with the name of the target data source from the Running list.
      • To have a new instance of console opened, choose Open New, then choose the target data source.
  4. View and analyze the query execution result in the Result and Output panes.
To run an injected SQL statement with parameters
  1. Prepare the desired SQL statement with parameters enclosed in #, $, or ? characters. Inject the statement in the source code.
  2. Position the cursor at the desired SQL injection and press Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt+EnterAlt EnterAlt EnterCommand 1Alt Enter and choose Run Query in Console on the context menu.
  3. Choose the target data source.
  4. In the Please Provide Missing Values dialog box that opens, specify the values to substitute for the parameters and click OK.
  5. View and analyze the query execution result in the Result and Output panes.

See Also

Procedures:

Language and Framework-Specific Guidelines:

Reference:

Web Resources: