Connecting to Crate with Java

Java Client

Add Crate to you Project

A simple way to configure your project to connect to a Crate cluster is to visit the Java client page on Bintray and click the Set Me Up button. This will give you a Maven or Gradle configuration that can be pasted into your current project or downloaded for a new project.

For manual configuration follow these steps depending on your build system of choice.


Add the following to your pom.xml file:



Add Crate as a dependency to your Gradle file:

repositories {

dependencies {
  compile 'io.crate:crate-client:VERSION

Connect to Crate

Import the Crate client and create a new client object:

import io.crate.client.CrateClient;
CrateClient client = new CrateClient(

Whilst it's possible to just connect to one node in a cluster, we recommend specifying all nodes to allow for automatic routing to another node if one becomes available.

Want to Know More?

  • More detailed documentation on the Crate Java client is available here.

Next Steps