Connecting to Crate with Java

Java Client

Deprecation Notice

The Java client is deprecated in versions of Crate 0.57.0 and will be removed by 0.58.0 and later. Instead the recommended way to access Crate from Java is via our JDBC driver.

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