Skip to main content

Connecting Retool to ClickHouse

1. Gather your connection details

To connect to ClickHouse with HTTP(S) you need this information:

  • The HOST and PORT: typically, the port is 8443 when using TLS or 8123 when not using TLS.

  • The DATABASE NAME: out of the box, there is a database named default, use the name of the database that you want to connect to.

  • The USERNAME and PASSWORD: out of the box, the username is default. Use the username appropriate for your use case.

The details for your ClickHouse Cloud service are available in the ClickHouse Cloud console. Select the service that you will connect to and click Connect:

ClickHouse Cloud service connect button

Choose HTTPS, and the details are available in an example curl command.

ClickHouse Cloud HTTPS connection details

If you are using self-managed ClickHouse, the connection details are set by your ClickHouse administrator.

2. Create a ClickHouse resource

Login to your Retool account and navigate to the Resources tab. Choose "Create New" -> "Resource":

Creating a new resource

Select "JDBC" from the list of available connectors:

Choosing JDBC connector

In the setup wizard, make sure you select com.clickhouse.jdbc.ClickHouseDriver as the "Driver name":

Selecting the right driver

Fill in your ClickHouse credentials in the following format: jdbc:clickhouse://HOST:PORT/DATABASE?user=USERNAME&password=PASSWORD. If your instance requires SSL or you are using ClickHouse Cloud, add &ssl=true to the connection string, so it looks like jdbc:clickhouse://HOST:PORT/DATABASE?user=USERNAME&password=PASSWORD&ssl=true

Specifying your credentials

After that, test your connection:

Testing your connection

Now, you should be able to proceed to your app using your ClickHouse resource.