# Configure connection

Procedure: Enable the Database Tools and SQL plugin

This functionality relies on the  Database Tools and SQL plugin, which  is bundled and enabled in IntelliJ IDEA   by default. If the relevant features are not available, make sure that you did not disable the plugin.

> **Note:**
> Database Tools and SQL functionality support is limited in IntelliJ IDEA without the Ultimate subscription.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Plugins`.

2. Open the Installed tab, find the Database Tools and SQL plugin, and select the checkbox next to the plugin name.

When you [create a data source](managing-data-sources.html#create_a_data_source), IntelliJ IDEA connects to a database automatically to [introspect](introspection.html#introspection) the default or selected schemas.

## Connection options

Procedure: Set a time zone for a connection

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

2. Select a data source that you want to modify and click the Options tab.

3. In the Time zone field, start typing the time zone that you want to use.

4. Apply settings and click OK.

![Select a time zone in the Time zone field](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_set_time_zone.png)

Procedure: Keep the connection alive

You can keep the connection to a database alive by running a keep-alive query after the specified period. You can define the custom query in the driver settings for unsupported databases.

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

2. On the  Data Sources  tab, select a data source that you want to modify.

3. On the Options tab, select the Run keep-alive query each checkbox and type a number of seconds after which IntelliJ IDEA must run a keep-alive query again.

> **Tip:**
> To set a custom keep-alive query for a driver, select the necessary driver on the Drivers tab. Click the Options tab. In the Keep-alive query field, specify the query that you want to use as a keep-alive query.

Procedure: Disconnect from a database in a specified period

You can specify a period in seconds after which IntelliJ IDEA terminates the connection.

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

2. On the  Data Sources  tab, select a data source that you want to modify.

3. On the Options tab, select the Auto-disconnect after checkbox and type a number of seconds after which IntelliJ IDEA terminates the connection.

Procedure: Set a predefined query to run as you establish a connection

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

2. On the  Data Sources  tab, select a data source that you want to modify.

3. On the Options tab, in the Startup script field, specify the query that you plan to run on a connection to a database.

![Run a predefined query as you establish a connection](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_specify_startup_script.png)

Procedure: Refresh the database state

If someone changed the remote database data or view, the local view of the database might differ from the actual state of the database.

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

2. On the  Data Sources  tab, select a data source that you want to modify.

3. On the Options tab, select the Auto sync checkbox.

If the Auto sync checkbox is cleared, the view of the data source in the   Database   tool window  is synchronized with the actual state of the database only when you click the Refresh icon (![the Refresh button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.refresh.svg)) in the toolbar or press `Ctrl+F5` (Windows), `⌘ R` (macOS), `⌃ F5` (IntelliJ IDEA Classic (macOS)), `⌘ R` (macOS System Shortcuts), `Ctrl+F5` (XWin), `Ctrl+F5` (GNOME), `Ctrl+5` (KDE), `Ctrl+F5` (Emacs), `Ctrl+F5` (Sublime Text), `⌘ R` (Sublime Text (macOS)), `Ctrl+F5` (NetBeans), `Ctrl+Alt+R` (Visual Studio), `⌘ ⌥ R` (Visual Studio (macOS)), `Ctrl+F5` (Eclipse), `Ctrl+F5` (Eclipse (macOS)).

![Refresh the database state](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_syncronize_database_state.png)

Procedure: Filter objects with the object filter

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

2. On the  Data Sources  tab, select a data source that you want to modify.

3. On the Schemas  tab, type filtering options in the Object filter field.

Use the following pattern when you compose an expression for the Object filter field.

`<type>:[-]<pattern>`, where:

* `<type>` might be an aggregate, collation, event, fdw, ftable, mview, operator, package, role, routine, sequence, synonym, table, user, view, vtable.

* `<pattern>` is a regular expression. To exclude an item, prepend with `-` (minus). For more information about regular expressions, refer to [Class Patterns](https://docs.oracle.com/javase/1.5.0/docs/api/java/util/regex/Pattern.html) at JavaTM 2 Platform Standard Edition 5.0 API Specification.

> **Tip:**
> Also, you can check [the following video at youtube.com](https://www.youtube.com/watch?v=U5SOD-eeK50&t=178s) that describes how to hide objects that you do not need by using the object filter.

![The Object Filter field in data source options](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_data_source_options_filter.png)

Procedure: Filter databases and schemas

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

2. On the  Data Sources  tab, select a data source that you want to modify.

3. On the Schemas  tab, type filtering options in the Schema pattern field.

* `@`: the current database or schema.

* `*`: every database or schema. You can list schemas after `*:`.

Consider the following examples:

* `*:*`: all schemas in all databases.

* `@:*`: all schemas from the current database

* `@:@`: only the current schema

* `*:dbo|@:@|db1:s1,s2,s3`: the `dbo` schema from all databases, the current schema, schemas `s1,s2,s3` from the `db1` database.

## Connection modes

Procedure: Enable read-only mode for a connection

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

2. On the  Data Sources  tab, select a data source that you want to modify.

3. On the Options tab, select the Read-only checkbox.

![Enable read-only mode for a connection](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_enable_read_only_for_connection.png)

Procedure: Single database mode

When you connect to a data source, IntelliJ IDEA can retrieve and display you all the databases that the data source has. But in some cases (for example, with certain settings of PgBouncer), you can or are allowed to work only with a certain database. With the Single database mode enabled, you see in the database tree view only the database that you specified in the connection settings, not all the databases that were received from the data source.

Consider using this setting, for PostgreSQL, Azure SQL Database, Greenplum, Amazon Redshift.

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

2. On the  Data Sources  tab, select a data source that you want to modify.

3. On the Options tab, select Single database mode.

4. Click Apply.

![Enable the single database mode](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_enable_single_database_mode.png)

## Transaction control

In IntelliJ IDEA, you can use one of the available ways your transactions are committed to a database, and also select the isolation level for the transactions.

### Transaction mode

A commit ends a transaction and makes all changes available to other users. In IntelliJ IDEA, you can select how you want to commit transactions: automatically or manually.

![How changes are committed to a database](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_submit_transation_control.svg)

The data editor accumulates all the changes that you made. When you click ![the Submit button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.submitDB.svg) Submit, IntelliJ IDEA submits these changes and processes them according to the selected commit mode:

* In the Tx:Auto mode, IntelliJ IDEA commits all the changes automatically once you click ![The Submit button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.submitDB.svg) Submit.

* In the Tx:Manual mode, changes are stored in a transaction to the database. When you click ![the Submit and Commit button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.commit.svg) Submit and Commit, transactions are committed to the database. When you commit the transaction, the ![the Submit and Commit button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.commit.svg) Submit and Commit button disables (grays out). It means that all the transactions have been committed.

If the commit mode is set to Tx:Auto, each change of values, rows, or columns is implicitly committed and cannot be rolled back. In the Tx:Auto commit mode, the ![The Submit and Commit button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.commit.svg) Submit and Commit and ![The Rollback button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.rollback.svg) Roll Back buttons are disabled and hidden.

If the commit mode is set to Tx:Manual, you can explicitly submit or roll back the submitted changes by clicking ![The Submit button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.submitDB.svg) Submit or ![The Rollback button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.rollback.svg) Roll Back. To commit changes to a database, click ![The Commit button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.commit.svg) Submit and Commit.

### Transaction isolation

The Tx switch can also be used for selecting the [isolation level](https://en.wikipedia.org/wiki/Isolation_(database_systems)) for the transactions.

The list of available transaction isolation levels depends on the DBMS.

Procedure: Set the default transaction control settings for a data source

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

2. In the list of created data sources, click the data source that you want to modify.

3. Click the Options tab.

4. From the Transaction control list, select the default transaction mode and transaction isolation for the selected data source.

The selected transaction control is applied for new [query consoles](query-consoles.html) and [query files](query-files.html).

![Default transaction mode for a data source](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_default_transaction_mode_for_a_data_source.png)

Procedure: Change the transaction control settings in data editor

1. On the data editor toolbar, click the transaction control dropdown.

2. Select the transaction mode and isolation level from the list.

![Change the transaction level](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_change_transaction_mode.png)

Procedure: Submit changes automatically

By default, changes are not submitted to a database unless you click ![The Submit icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.submitDB.svg) Submit, or press `Ctrl+Enter` (Windows), `⌘ ⏎` (macOS), `⌘ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ ⏎` (macOS System Shortcuts), `Ctrl+Enter` (XWin), `Ctrl+Enter` (GNOME), `Ctrl+Enter` (KDE), `Ctrl+Enter` (Emacs), `Ctrl+Enter` (Sublime Text), `⌘ ⏎` (Sublime Text (macOS)), `Ctrl+Enter` (NetBeans), `Ctrl+Enter` (Visual Studio), `⌘ ⏎` (Visual Studio (macOS)), `Ctrl+Enter` (Eclipse), `⌘ ⏎` (Eclipse (macOS)). You can enable the Submit changes immediately option to submit your changes automatically.

1. In settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)), navigate to `Tools | Database | Data Editor and Viewer`.

2. Select Submit changes immediately in the Data Modification.

3. Click OK.

![Submit changes immediately](https://resources.jetbrains.com.cn/help/img/idea/2026.2/submit_changes_immediately.png)

## See also

### Reference

[Data Sources and Drivers dialog](data-sources-and-drivers-dialog.html)

### Tool Windows

[Database tool window](database-tool-window.html)

