> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Use IntelliJ IDEA with CockroachDB

You can use CockroachDB in [IntelliJ IDEA](https://www.jetbrains.com/idea/) as a [database data source](https://www.jetbrains.com/help/idea/managing-data-sources.html#data_sources), which lets you accomplish tasks like managing your database's schema from within your IDE.

## Support

As of CockroachDB , IntelliJ IDEA only has **partial support**. This means that the application is mostly functional, but its integration still has a few rough edges.

### Versions

The level of support in this document was tested as of the following versions:

* CockroachDB v19.1.0-beta.20190225
* IntelliJ IDEA Ultimate 18.1.3
* PostgreSQL JDBC 41.1

> [!NOTE]
>
> This feature should also work with other JetBrains IDEs, such as PyCharm, but Cockroach Labs has not yet tested its integration.

### Warnings and errors

Users can expect to encounter the following behaviors when using CockroachDB within IntelliJ IDEA.

* **Warnings** do not require any action on the user's end and can be ignored. Note that even if a message indicates that it is an "error", it can still be treated as a warning by this definition.
* **Errors** require the user to take action to resolve the problem and cannot be ignored.

#### Warnings

##### \[XXUUU] ERROR: could not decorrelate subquery

![DBeaver - Select CockroachDB](https://mintcdn.com/cockroachlabs/8_H4KrPlYfe30hE8/images/common/intellij/XX000_error_could_not_decorrelate_subquery.png?fit=max\&auto=format\&n=8_H4KrPlYfe30hE8\&q=85\&s=55a64326f6617547aee2303637b737f0)

Displays once per load of schema.

***

##### \[42883] ERROR: unknown function: pg\_function\_is\_visible() Failed to retrieve

![DBeaver - Select CockroachDB](https://mintcdn.com/cockroachlabs/8_H4KrPlYfe30hE8/images/common/intellij/42883_error_pg_function_is_visible.png?fit=max\&auto=format\&n=8_H4KrPlYfe30hE8\&q=85\&s=ef341b6549f722b4b8b9fdee9d0bf2db)

Display periodically. Does not impact functionality.

#### Errors

##### \[42703] org.postgresql.util.PSQLException: ERROR: column "n.xmin" does not exist

![DBeaver - Select CockroachDB](https://mintcdn.com/cockroachlabs/8_H4KrPlYfe30hE8/images/common/intellij/42073_error_column_n_xmin_does_not_exist.png?fit=max\&auto=format\&n=8_H4KrPlYfe30hE8\&q=85\&s=07055fb616a044a9ae4e75d69f842d95)

Requires setting **Introspect using JDBC metadata** ([details below](#set-cockroachdb-as-a-data-source-in-intellij)).

***

## Set CockroachDB as a data source in IntelliJ

1. Launch the **Database** tool window. (**View** > **Tool Windows** > **Database**) ![DBeaver - Select CockroachDB](https://mintcdn.com/cockroachlabs/8_H4KrPlYfe30hE8/images/common/intellij/01_database_tool_window.png?fit=max\&auto=format\&n=8_H4KrPlYfe30hE8\&q=85\&s=bc8fd1c83d89d17642959cb92dc71d56)
2. Add a PostgreSQL data source. (**New (+)** > **Data Source** > **PostgreSQL**)![DBeaver - Select CockroachDB](https://mintcdn.com/cockroachlabs/8_H4KrPlYfe30hE8/images/common/intellij/02_postgresql_data_source.png?fit=max\&auto=format\&n=8_H4KrPlYfe30hE8\&q=85\&s=7c4912548cb8afb136d28bebc0be1178)
3. On the **General** tab, enter your database's connection string:

   | Field | Value |
   | - | - |
   | **Host** | Your CockroachDB cluster's hostname |
   | **Port** | Your CockroachDB cluster's port. By default, CockroachDB uses port **26257**. |
   | **Database** | The database you want to connect to. Note that CockroachDB's notion of database differs from PostgreSQL's; you can see your cluster's databases through the [`SHOW DATABASES`](https://docs.cockroachlabs.com/docs/v24.2/show-databases) command. |
   | **User** | The user to connect as. By default, you can use **root**. |
   | **Password** | If your cluster uses password authentication, enter the password. |
   | **Driver** | Select or install **PostgreSQL** using a version greater than or equal to 41.1. (Older drivers have not been tested.) |

   ![DBeaver - Select CockroachDB](https://mintcdn.com/cockroachlabs/8_H4KrPlYfe30hE8/images/common/intellij/03_general_tab.png?fit=max\&auto=format\&n=8_H4KrPlYfe30hE8\&q=85\&s=d2f826d33e0c6912379bf322492cf723)
4. Install or select a **PostgreSQL** driver. We recommend a version greater than or equal to 41.1.
5. If your cluster uses SSL authentication, go to the **SSH/SSL** tab, select **Use SSL** and provide the location of your certificate files.
6. Go to the **Options** tab, and then select **Introspect using JDBC metadata**.![DBeaver - Select CockroachDB](https://mintcdn.com/cockroachlabs/8_H4KrPlYfe30hE8/images/common/intellij/04_options_tab.png?fit=max\&auto=format\&n=8_H4KrPlYfe30hE8\&q=85\&s=3a20829dd9b6cddd09f169d30752d237)
7. Click **OK**.

You can now use IntelliJ's [database tool window](https://www.jetbrains.com/help/idea/working-with-the-database-tool-window.html) to interact with your CockroachDB cluster.

## Report issues with IntelliJ IDEA & CockroachDB

If you encounter issues other than those outlined above, please [contact Support](https://docs.cockroachlabs.com/docs/v24.2/support-resources) with the following details about the environment where you encountered the issue:

* CockroachDB version ([`cockroach version`](https://docs.cockroachlabs.com/docs/v24.2/cockroach-version))
* IntelliJ IDEA version
* Operating system
* Steps to reproduce the behavior
* If possible, a trace of the SQL statements sent to CockroachDB while the error is being reproduced using [SQL query logging](https://docs.cockroachlabs.com/docs/v24.2/logging-use-cases#sql_exec).

## See also

* [Client connection parameters](https://docs.cockroachlabs.com/docs/v24.2/connection-parameters)
* [Third-Party Database Tools](https://docs.cockroachlabs.com/docs/v24.2/third-party-database-tools)
