Connecting to ClickHouse with Java

In this example we will be using the official Java client maintained by the ClickHouse team. Before you begin, it is imperative to review the general steps and considerations for connecting to a ClickHouse cluster as outlined in Connecting to a ClickHouse Cluster.

1. Add the dependencies below to your project 

For tarball installation:

2. Use this code below to build connections to the nodes and try executing a SELECT query on the cluster 

Simply replace the password of the icclickhouse user with that from the Connection Info page. The isrgrootx1.pem file is also available for downloading from the same page on the console.