--- title: "Databases" description: "Connect to SQL databases, browse schemas, run queries in a console, and view, edit, import and export data." --- The **Database** tool window connects to SQLite, PostgreSQL, MySQL/MariaDB, Microsoft SQL Server, Oracle, ClickHouse and Snowflake, plus databases that speak one of their protocols. These presets use built-in drivers. You can also connect with a vendor JDBC driver installed locally. Open it from **Tools › Database** or **View › Tool Windows › Database**. The **Tools** menu also has **New Data Source…** and **Open Query Console**. ## Supported databases **New › Data Source** lists these presets: | Engine | Presets | | ---------- | -------------------------------------------------------------------------------------------- | | PostgreSQL | PostgreSQL, Amazon Redshift, CockroachDB, Greenplum, Neon, Supabase, TimescaleDB, YugabyteDB | | MySQL | MySQL, MariaDB, Amazon Aurora MySQL, OceanBase (MySQL mode), SingleStore, StarRocks, TiDB | | SQL Server | Microsoft SQL Server | | Oracle | Oracle 19 or later (built-in thin driver, no client library) | | ClickHouse | ClickHouse (over HTTP) | | Snowflake | Snowflake (over HTTPS, see below) | | SQLite | SQLite | Presets set the default port and, where needed, SSL (for example Redshift, Neon and Supabase require SSL). ## JDBC drivers In a named data source's **General** tab, **Driver** defaults to **Built-in**. Use **Manage Drivers…** to view or add JDBC profiles for that data source type. Select the profile from **Driver** to use JDBC while keeping the source type and icon. **Go to Driver** opens the selected profile and its JAR list. Choose **New › Data Source › Custom JDBC** for databases without a preset, or open its **Manage Drivers…** to see all profiles and change their associated types. Add a named profile with the vendor's driver JAR, any dependency JARs, the fully qualified driver class, and an optional JDBC URL template. OpenIDEA reads the driver classes declared in the selected JARs. You can choose a different class or enter its full name manually. Use `{host}`, `{port}`, `{database}` or `{file}` in a template to get matching connection fields, or edit the JDBC URL directly. Only import drivers you trust. OpenIDEA loads their code in a separate process using an installed Java 17 or newer runtime. When switching to JDBC, configure TLS and driver-specific settings in the JDBC URL or **Advanced** properties. If the built-in source used an SSH tunnel, configure an equivalent route for the JDBC connection. JDBC uses auto-commit. Review the built-in startup script, default schema, and time zone, and configure equivalent settings supported by your JDBC driver or database. For enforced read-only access, use a database account with read-only privileges. Enter a separate JDBC password when converting a Snowflake source that used key pair, token, or browser authentication and your JDBC driver needs a password. Select the profile, enter the vendor's JDBC URL, and use the **User**, **Password**, and **Advanced** fields for credentials and driver properties. The URL and Advanced properties are stored in the data source configuration. Put credentials in the password field to use the existing OS credential store. On Linux, saving a password requires a running Secret Service. You can also enter the password for the current session. The **Read-only** option asks the JDBC driver for a read-only connection. Use a database account with read-only privileges to enforce it. Cancelling a query keeps the session and its temporary tables when the driver stops the statement. If the driver does not respond within three seconds, OpenIDEA closes the session. A submitted statement can still finish on the server. **Test Connection** reports the database product and version. Schema, table and column browsing use JDBC metadata; the SQL console supports auto-commit queries and updates. Vendor-specific DDL, execution plans and table-grid writes are unavailable for custom drivers. For a file-backed database, use an absolute path to choose its location. Relative paths start in the persistent `jdbc/files` folder inside OpenIDEA’s application data directory. Profiles are reused across projects. If a project file changes a connection's URL or properties outside the IDE, review the settings in the data source dialog and save them before reconnecting. ## Add a data source Click **+** in the Database tool window (or press `⌘N` / `Alt+Insert` there) and choose: - **Data Source ›** a preset from the list above. - **Data Source from File…** to open a SQLite file. - **Data Source from URL…** to paste a URL such as `postgresql://user@localhost:5432/db`. Schemes like `mysql://`, `mariadb://`, `sqlserver://`, `oracle://`, `clickhouse://`, `sqlite:path` and `jdbc:` URLs are accepted. - **Import from Clipboard** to read a connection URL from the clipboard. The data source dialog has a name, an optional **Color:** (tints the tree and console tabs), **Global** (make it available in all projects) and a comment, then these tabs: **Driver:**, **Host:**, **Port:**, **User:**, **Password:** with **Save password**, **Database:** and **URL:**. Editing the URL fills in the fields, and the other way round. Set **Connection type:** to **URL only** to connect with the URL alone. For SQLite there is a **File:** field instead; the file must exist. **Test Connection** shows the server version or the error. - **Read-only**: blocks writes at the session level where the database supports it (PostgreSQL, MySQL, SQLite, Oracle, ClickHouse) and disables grid editing. - **Transaction control:** **Auto** or **Manual** (ClickHouse is always Auto). - **Default schema:** (PostgreSQL `search_path`) or **Current schema:** (Oracle). - **Time zone:**, a keep-alive query interval, and **Auto-disconnect after** a number of idle seconds. - **Single database mode** (PostgreSQL): show only the configured database. - **Startup script:** runs on every new connection. **Use SSH tunnel** with a saved SSH configuration or custom fields (host or `~/.ssh/config` alias, port, user, and authentication by **OpenSSH config and authentication agent**, **Password** or **Key pair**). SSL **Mode:** **Disable**, **Prefer**, **Require**, **Verify CA** or **Verify Full**, with optional **CA file:**, **Client certificate file:** and **Client key file:**. Not available for SQLite. Choose which databases (PostgreSQL) and schemas appear in the tree: all, a picked list, or name patterns with `*` and `?`. **Load Names from Server** fetches the list. **Object filter:** limits tables, views, routines and sequences by name. **Show internal system schemas** and **Show template databases** (PostgreSQL) are off by default. Driver properties as name/value pairs, for example `statement_timeout` (PostgreSQL), `sql_mode` (MySQL, set as session variables), `journal_mode` (SQLite pragmas), `NLS_DATE_FORMAT` (Oracle) or `max_threads` (ClickHouse). `connect_timeout` (seconds) works for every driver. ### Where settings and passwords are stored - Project data sources: `.openidea/data-sources.toml` in the project. - Global data sources: `data-sources.toml` in the IDE's data directory (see [Data directories](/en/reference/data-directories)). - You can edit these files by hand or have a coding agent edit them while the project is open: the Database tool window picks up the change, and connections of data sources whose settings changed or that were removed are closed. - Passwords are never written to these files. Saved passwords go to the OS credential store (Keychain, Windows Credential Manager or Secret Service). Unsaved ones are kept in memory for the session; OpenIDEA asks for them when it connects. ## Browse the database The tree shows data source › database (PostgreSQL) › schema › `tables`, `views`, `materialized views`, `routines` and `sequences`. Tables contain `columns`, `keys`, `foreign keys`, `indexes` and `triggers`. Nodes load when you expand them. Turn on **Separate Procedures and Functions** in the tool window's options menu to split `routines`. Double-click a table to edit its data, a data source to open its console, and a routine, sequence or trigger to see its DDL. Type in **Filter objects** to filter the tree. | Action | macOS | Windows/Linux | | ------------------------------------------ | ---------------- | ------------------ | | New… (data source, console, table, column) | `⌘N` | `Alt+Insert` | | Data Source Properties… | `⇧Enter` | `Shift+Enter` | | Refresh | `⌘R` | `Ctrl+F5` | | Deactivate (disconnect) | `⌘F2` | `Ctrl+F2` | | Edit Data | `F4` | `F4` | | Go to DDL | `⌘B` | `Ctrl+B` | | Quick Documentation | `F1` | `Ctrl+Q` | | Jump to Query Console… | `⌘⇧F10` | `Ctrl+Shift+F10` | | Rename… | `⇧F6` | `Shift+F6` | | Modify Table… | `⌘F6` | `Ctrl+F6` | | Drop… | `Delete` or `⌘⌫` | `Delete` | | Copy Reference | `⌘⌥⇧C` | `Ctrl+Alt+Shift+C` | | Duplicate (data source) | `⌘D` | `Ctrl+D` | | Generate DDL to Clipboard | `⌘⌥⇧G` | `Ctrl+Alt+Shift+G` | | Generate DDL to Query Console | `⌘⌥⇧B` | `Ctrl+Alt+Shift+B` | These keys work while the Database tree has focus. The context menu also has **Truncate…**, **Run SQL Script…** (runs every statement of a `.sql` file), **Import Data from File…**, **Go to Referenced Table** (on foreign keys), SQL templates (select, insert, update, delete) and **Remove Data Source…**. **Modify Table…** and **New › Table** open a dialog to add, drop or change columns (name, data type, not null, primary key, default) with a live SQL preview. SQLite can only rename or drop existing columns. ClickHouse tables can't be modified this way. ## Query console Each data source has a query console, a `.sql` file kept in the IDE's data directory. Open it with **Query Console** (`⌘⇧L` / `Ctrl+Shift+Q`), from the tree, or with **Tools › Open Query Console**. Any writable `.sql` file in the project gets the same toolbar, so you can bind it to a data source and run it. The console toolbar has: - **Execute** (`⌘Enter` / `Ctrl+Enter`): runs the selected statements, or the statement at the caret. - **Explain Plan**: shows the plan in a **Query Plan** tab. - **Cancel Running Statement**. Cancelling inside a manual transaction rolls it back. - **Browse Query History**: the last 500 statements per data source, with search and **Paste**. - A row limit (100 to 50,000; default 500). - **Tx: Auto** / **Tx: Manual**. In manual mode **Commit** and **Roll Back** appear. - A schema picker (PostgreSQL, MySQL, SQL Server, Oracle, Snowflake) and the data source picker. Snowflake consoles also have warehouse and role pickers. Statements are split on `;`, respecting strings, comments and PostgreSQL dollar quoting. Oracle PL/SQL blocks are kept whole, and a line with only `/` ends a statement. Snowflake `$$` bodies and Snowflake Scripting blocks (`BEGIN … END`, `DECLARE …`) are kept whole too. Parameters such as `:id`, `?`, `$1` or `@name` open a **Parameters** dialog; values are inserted as SQL text, so quote strings. SQL completion knows the connected schema: tables after `FROM`/`JOIN` (with join conditions from foreign keys), columns in scope, and each dialect's keywords and functions. Unresolved tables and columns are flagged, and Go to Declaration, Quick Documentation and Reformat Code work in the console. See [SQL](/en/languages/sql) for SQL files in general. ## Results and data editing Results appear in the **Services** tool window under the **Database** tab: an **Output** tab logs every statement, and each result set gets a **Result N** tab (up to 12, pinned tabs excepted). Running a console again replaces its previous results: its unpinned result tabs make way for the new run, which gets one tab per result set (**Result N**, or **Result N**, **Result N-2**, … when several selected statements return rows). A run with no result sets, such as an `UPDATE`, keeps the previous results. Results from other consoles stay. To keep a result, pin it with **Pin Tab** in the result tab's context menu or the pin button on the result toolbar; the tab's close button becomes a pin button that unpins it, so a stray click or middle-click can't close it, and later runs open new tabs instead. Rerunning or paging a pinned result updates it in place. Replacing a result discards changes you have not submitted in it. **Submit** or **Revert** them, or pin the tab, before running the console again. Right-click a result tab (or focus it and press `Shift+F10`) for **Close**, **Close Others**, **Close All**, **Close All but Pinned**, **Pin Tab** / **Unpin Tab**, **Rename Tab**, **Select Next Tab** and **Select Previous Tab**. They act on the result tabs only; **Output** stays. Renamed titles last until the result is closed or replaced. With focus on a result tab or inside a result, use `⇧⌘]` / `⇧⌘[` in the IntelliJ macOS keymap (`⌃→` / `⌃←` also work), or `Alt+→` / `Alt+←` in IntelliJ Windows/Linux. VS Code and Eclipse presets use their respective editor-tab navigation defaults. Switching focuses the destination result tab. Result navigation stays scoped to Results and is blocked while a menu or dialog is open. Customize database result shortcuts independently of editor shortcuts in **Settings › Keymap**. Closing a selected result activates its left neighbor, or its right neighbor if there is no result on the left. When no results remain, **Output** is selected. Closing an inactive result keeps the current selection. - **Table** or **Chart** view (bar or line, with X/Y columns and an aggregation). - Paging with page sizes 10 to 1,000; click the row count to count all rows. - **Search in results** and a per-column local filter on the loaded rows. - A side panel with **Record**, **Value** and **Aggregates** (count, distinct, nulls, sum, average, median, min, max). - JSON values get a JSON editor with **Reformat** and **Open in Window**. ### Edit data **Edit Data** (`F4`) opens a table in an editor tab with server-side paging (100 to 5,000 rows), a `WHERE` filter and an `ORDER BY` field (both with completion). Click a column header to sort; `Shift`-click to add more sort columns. - Double-click, `Enter` or `F2` edits a cell; `Shift+Enter` opens a larger editor. Pasting tab-separated text fills several cells. - **Add Row** (`⌘N` / `Alt+Insert`), **Delete Rows** (`Ctrl+Y` on Windows and Linux), **Set NULL** (`⌘⌫` / `Ctrl+Backspace`), **Set DEFAULT** (`⌘⇧⌫` / `Ctrl+Shift+Backspace`). `Space` toggles booleans. - **Reload Page** (`⌘R` / `Ctrl+F5`), **Previous Page** and **Next Page** (`⌘⌥↑` / `⌘⌥↓`, `Ctrl+Alt+Up` / `Ctrl+Alt+Down`). These, the copy commands and **Export Data** are actions: find them with **Find Action** and assign shortcuts in **Settings › Keymap**. - **Submit** (`⌘Enter` / `Ctrl+Enter`) sends all pending changes in one transaction; **Revert** (`⌘⌥Z` / `Ctrl+Alt+Z`) discards them. Console results are editable the same way when the query is a plain select from one table that includes the primary key. Tables without a primary key, joins, aggregates, `UNION` queries, read-only data sources and ClickHouse results are read-only. ## Export and import The export button offers **Export Data…** and quick copies: **Copy as CSV**, **Copy as TSV**, **Copy as JSON**, **Copy as SQL Inserts**, **Copy as Markdown** and **Copy as One-Row**. The **Export Data** dialog adds **Transpose**, column and row headers, a preview, **Copy to Clipboard** and **Export to File**. Export covers the rows that are loaded (the current page). **Import Data from File…** loads CSV, TSV or TXT into a table: the separator is detected, the first row can be a header matched to columns by name, and empty values can become `NULL`. The import runs in one transaction. It is not available for ClickHouse. ## ClickHouse The built-in HTTP driver uses a named session by default (`use_http_session=true`). Route requests to one node or enable session affinity. If the session expires or another node reports code 372, OpenIDEA shows a reconnect error and never replays the statement. For endpoints that route each request to a different node, add **Advanced** property `use_http_session` with value `false`. Each request omits `session_id`, `session_check` and `session_timeout`, and sends the configured database (or **Default schema**), time zone and Advanced settings again. **Read-only** sends `readonly=1` on every request. Stateless statements must be independent: `USE`, standalone `SET`, temporary tables and other session state cannot carry over to later requests. Configure the database and settings on the data source. Startup scripts and explicit session properties (`session_id`, `session_check`, `session_timeout`) are rejected. SQL transactions and statement caching are unsupported in either mode. For strict read-only accounts behind a load balancer, set `use_http_session=false` and enable **Read-only**. If the initial connection check receives ClickHouse code 164 for a driver-managed result setting, OpenIDEA repeats the check without its result-limit and JSON number-format settings. Each request still sends `readonly=1`, and the grid still retains only the requested page. Configure server-side limits in the account's settings profile. With the server's default JSON settings, `NaN` and infinities may appear as `NULL`. Use consistent account profiles across replicas. If the first node accepts the driver's result settings and a later node rejects them, OpenIDEA reports the error on that request. Connect again after aligning the profiles. ## Oracle Oracle connections use a built-in pure-Rust thin driver, so no Oracle client library or `ORACLE_HOME` is needed. It supports Oracle Database 19 or later. On **General**, set host, port (1521) and the service name (for example `ORCLPDB1`) in **Database:**. A full TNS descriptor, or a TNS alias resolved from `tnsnames.ora` (`TNS_ADMIN` or `$ORACLE_HOME/network/admin`), also works there. URLs such as `oracle://scott@db.example.com:1521/ORCLPDB1` and `jdbc:oracle:thin:@//db.example.com:1521/ORCLPDB1` are accepted too. If login fails with `ORA-01017` although the password is right, the account may only have old 10G password verifiers; setting the same password again (`ALTER USER … IDENTIFIED BY …`) creates the newer ones. The tree shows packages (their DDL is the specification and body) next to tables, views, routines and sequences. Oracle schemas are database users; system accounts appear only with **Show internal system schemas**. ## Snowflake Choose **Data Source › Snowflake** and fill in: - **Account:** the account identifier (`myorg-myaccount`, or `xy12345.eu-central-1`), or the account's host name. - **User**, and optionally **Database**, **Schema**, **Warehouse** and **Role** (empty: the user's defaults). - **Authentication:** - **Key pair** — the RSA private key file (PKCS#8 `.p8`, encrypted or not, or PKCS#1) and its passphrase. Only the path is saved; the key is read at each sign-in. - **Single sign-on (web browser)** — opens the default browser on your identity provider's page. Not available in remote projects. - **Password**, **Programmatic access token** or **OAuth token**. The passphrase, password or token is kept in the operating system's credential store when **Save password** is on, and never written to the data source file. A JDBC URL (`jdbc:snowflake://…?warehouse=…&db=…&role=…`) typed in the **URL** field fills the settings. The tree shows databases, then schemas with their tables, views, routines, sequences, stages, streams, tasks, pipes and file formats. It reads them with `SHOW` commands, which need no running warehouse and list what the role may see. All databases of a data source share one sign-in; consoles and the tree use separate sessions, so a long query does not block browsing. **Advanced** properties are session parameters (for example `QUERY_TAG`, `STATEMENT_TIMEOUT_IN_SECONDS`). Limits: `TIMESTAMP_LTZ` values are shown in UTC; SSH tunnels are not offered; results are read in JSON. ## Not supported - Native drivers for MongoDB, Redis and BigQuery. - SQL Server `GO` batch separators. - A "run the whole console" action (use a selection, or **Run SQL Script…**). - Exporting more than the loaded page. - Date pickers and foreign key lookups in the grid. - Session-level read-only mode on SQL Server (only grid editing is blocked).