WebStorm 2023.2 Help

Connection to a database

This topic gives you an overview of how the connection to a database works in WebStorm. For more information about features and concepts, refer to the dedicated topics.

Data source

To connect to a database, WebStorm requires connection details (for example, host, port, password, SSH configuration settings, and so on). For every database, the connection details are stored in a dedicated connection configuration — data source.

Below is an example of the PostgreSQL data source settings in the Data Sources and Drivers dialog.

Data source with connection details for a PostgreSQL database


For a data source, connections to the database are established in special wrappers — sessions. Each session is a wrapper over a single connection, and it stores the connection's information (for example, whether it is active or not, transaction control mode, and other settings).

Sessions can have clients — files, whose queries are sent via the connection that the session holds. Data editor can also be a client for a session.

Depending on the way you create a new session, it can be connected either automatically, or after a certain action. Green dot in the corner of session's icon indicates the connected status.

You can create a new session by doing either of the following:

  • Open a query console or view database object's data in data editor.

    As a result, under the data source node in the Services tool window, the new session node appears with a client node under it.

    1. For a query console, the session will be connected once you perform an action that requires interaction with the database. For example, once you run a query.

    2. For a table, the session is connected automatically, as WebStorm requires an active connection to request the table data from the database, receive it, and display it in the data editor.

  • Perform an action that requires interaction with the database. For example, run a stored procedure or run a script via run configurations.

    As a result, the new connected session node appears under the data source node in the Services tool window.

Last modified: 22 September 2023