The database console lets you compose and execute SQL statements for any database defined in PhpStorm as a data source. It also lets 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 .
General console usage instructions are on this page:
- Opening the database console
- Viewing and modifying the console settings
- Changing the SQL dialect
- Closing the console
More specific subjects are discussed in:
See also, Database Console.
- Open the Database tool window.
- Select the DB data source for which you want to open the console or any node within that data source.
Do one of the following:
- Click on the title bar.
- Click on the toolbar (if the toolbar is not currently hidden).
- Select Console from the context menu.
- Press Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Shift Command F10Shift Command F10Shift Command F10.
As a result, the input pane opens as a separate editor tab. This is where you compose your SQL statements.
Then, when you execute your first statement (), the Database Console tool window opens. If the executed statement retrieves data (e.g. SELECT), there are two panes in the tool window shown on the Output and the Result tabs.
Otherwise, only the output pane is shown.
Additionally, you can open the Parameters pane () to manage parameters in SQL statements.
Before actually starting to use the console, you may want to take a look at the console settings and adjust them to your needs.
- To access these settings, click on the toolbar of the input pane or on the toolbar of the Database Console tool window (in the lower part of the workspace, if this tool window is currently shown).
As a result, the Database page of the Settings dialog opens. On this page, you can, for example, specify how:
- Query results are to be shown (the Data View section).
- Statement parameters are recognized (the Console section).
- Retrieved table data are converted into CSV, TSV and other formats (the Data Extractors section).
For more information, see Database.
By default, the SQL dialect used in the console is defined by the DBMS associated with the data source for which the console is opened. If for some reason you want to use a different dialect:
- Right-click in the editing area of the input pane to open the context menu.
Point to Change '<current_dialect_name>' dialect to and
select the necessary dialect.
In addition to particular dialects, also the following option is available:
- <Generic>. Basic SQL92-based support is provided including completion and highlighting for SQL keywords, and table and column names. Syntax error highlighting is not available. So all the statements in the input pane are always shown as syntactically correct.
To close the console, do one of the following:
- Click on the toolbar of the Dababase Console tool window.
- Press Ctrl+Shift+F4Ctrl+Shift+F4Ctrl+Shift+4Ctrl+Shift+F4Ctrl+Shift+F4Ctrl+Shift+F4Ctrl+Shift+F4Ctrl+WControl Shift F4Control Shift F4Command W.