How to Connect ClickHouse to DataGrip in PostgreSQL

Galaxy Glossary

How do I connect ClickHouse to DataGrip using the correct JDBC URL?

Create a JDBC data source in DataGrip pointing to your ClickHouse server so you can browse schemas, run queries, and manage data visually.

Sign up for the latest in SQL knowledge from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Description

Table of Contents

What driver do I need?

Install the official ClickHouse JDBC driver (com.clickhouse:clickhouse-jdbc) via DataGrip’s “Drivers” tab. This enables SSL, compression, and all ClickHouse-specific settings.

How do I add a ClickHouse data source?

Open File → Data Sources, click +, choose ClickHouse, and paste the JDBC URL. DataGrip auto-downloads the driver if missing.

What JDBC URL should I use?

Use the pattern jdbc:clickhouse://HOST:PORT/DATABASE?user=USER&password=PWD.Replace placeholders with your server details.

Example URL

jdbc:clickhouse://analytics.acme.com:8123/ecommerce?user=reporting&password=S3cr3t

Which advanced parameters matter?

Set ssl=true for encrypted traffic and compress=true for faster transfers. Toggle socket_timeout or session_id when running long analytical jobs.

Can I use SSH tunneling?

Yes. In the SSH/SSL tab select “Use SSH Tunnel”, fill bastion host, port, and key. DataGrip forwards traffic securely to ClickHouse.

How do I test the connection?

Click Test Connection.A green check confirms authentication, driver compatibility, and network reachability.

How do I run my first query?

After saving, double-click the new data source, open a new SQL console, and run a query such as SELECT count() FROM Orders.

Why are my tables missing?

Refresh the schema tree or grant SHOW DATABASES and SELECT privileges to your user.

How do I switch databases?

Either change the database in the JDBC URL or run USE other_db in the console.

Best practices for production

Store credentials in DataGrip’s password vault, enable SSL, and keep the driver updated.Limit result set size in Settings → Database to prevent memory spikes.

What common mistakes should I avoid?

Incorrect ports (8123 HTTP vs 9000 TCP) and mismatched drivers cause most failures. Confirm your ClickHouse server’s port and driver version.

Long-running query tips

Increase query_timeout in the JDBC URL or DataGrip’s “Query Execution” settings to avoid premature cancellations.

See it in action

Run the sample ecommerce query below to verify full CRUD access.

.

Why How to Connect ClickHouse to DataGrip in PostgreSQL is important

How to Connect ClickHouse to DataGrip in PostgreSQL Example Usage


-- Total revenue per customer this month
SELECT c.id, c.name, sum(oi.quantity * p.price) AS customer_spend
FROM Customers c
JOIN Orders o   ON o.customer_id = c.id AND toStartOfMonth(o.order_date) = toStartOfMonth(now())
JOIN OrderItems oi ON oi.order_id = o.id
JOIN Products p   ON p.id = oi.product_id
GROUP BY c.id, c.name
ORDER BY customer_spend DESC
LIMIT 25;

How to Connect ClickHouse to DataGrip in PostgreSQL Syntax


jdbc:clickhouse://<host>:<port>/<database>?user=<user>&password=<password>[&ssl=<true|false>][&compress=<true|false>][&query_timeout=<ms>]

Common Mistakes

Frequently Asked Questions (FAQs)

Can I connect to ClickHouse Cloud?

Yes. Use the cloud-provided host, port 9440, and enable ssl=true.

Does DataGrip support ClickHouse autocomplete?

Since 2023.1 DataGrip reads system tables to provide code completion, table hints, and quick documentation.

How do I refresh metadata after creating tables?

Press Ctrl+F5 or right-click the database and choose Reload Schemas.

Want to learn about other SQL terms?

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.