Manage connection sessions
In the Services tool window, you can view data sources, connection sessions, and session clients.
In the picture above:
Data source node.
Disconnected session.
Connected session.
Session clients.
For information about the connection session managing options and toolbar controls, refer to Services tool window controls.
When you connect to a database server from the IDE, DataGrip and the server establish a session to exchange information. The session is a wrapper that stores information about the connection (connected or disconnected), transaction control (automatic or manual), the DBMS_OUTPUT state for Oracle (enabled or disabled), and other settings.
A session has two states: connected and disconnected. When you run a query to a database or refresh an object state, the session connects. A small green circle indicates that communication between the IDE and a data source is active.
If you close DataGrip and open it again, all your sessions will be available in the Services tool window, but they will be disconnected.
A session node may include a different number of session clients. A session client is any entity that needs to communicate with a database. It can be a query console; an SQL file; a table, a view or any other object opened in the data editor.
The following table includes basic actions that you can use to work with sessions.
Action | Description |
---|---|
Create a connection session to a data source | Click the <session> list and select New session. |
Attach to an existing connection session | Click the <session> list and select an existing session. |
Detach a connection session | Click the <session_name> list and select an existing session. |
Rename a connection session | In the Services tool window, right-click a session and select Rename Session. |
Move a session or a data source to a separate tab | In the Services tool window, right-click a session or a data source and select Show in New Tab. To revert this action, close the separated tab. |
Close a connected session | In the Services tool window, right-click a session and select Close Session. The session will be detached from its session clients, it will also disappear from the list. |
Close all connection sessions | In the Services tool window, right-click a data source and select Close All Sessions. |
Configuring session options
Set a time zone for a session
Open data source properties. You can open data source properties by using one of the following options:
Navigate to
.Press Control+Alt+Shift+S.
In the Database Explorer ( ), click the Data Source Properties icon .
Select a data source that you want to modify and click the Options tab.
In the Time zone field, start typing the time zone that you want to use.
Apply settings and click OK.
Change a data source and a connection session
Detach a file from the current connection session. To detach the file, click Detach Session from the Sessions list.
From the list of dialects, select another dialect.
From the Sessions list, select a connection session of this dialect.
Services tool window controls
For more information about the Services tool window, see the Services tool window topic.
Sessions
Icon | Action | Description |
---|---|---|
Tx | Tx Mode and Tx Isolation | Choose the isolation level for database transactions and the way transactions are committed.
|
Commit Control+Alt+Shift+Enter | Commit the current transaction. | |
Rollback | Roll back the last transaction. | |
Cancel Running Statements Control+F2 | Stop execution of running statements. | |
Restore Default Layout Control+F2 | Restore visual elements of are arranged. | |
Rename Session | Display the Rename dialog where you can specify a name for a session. | |
Close Session | Close the selected session. | |
Show in New Tab | Move the selected items to a separate tab. | |
Open Each in New Tab | Split the selected items into separate tabs. | |
Open Each Tab in New Tab | Create separate tabs for each type of service. | |
Delete Delete | Close all opened sessions to a data source. Identical to Close All Sessions. |