Java

Connect to CrateDB and CrateDB Cloud from Java.

JDBC

JDBC is the standard Java API that provides a common interface for accessing databases in Java.

Driver options

Choose one of two JDBC drivers:

Prefer the PostgreSQL JDBC driver first, it is often already in your classpath and works out of the box. If your application or framework emits PostgreSQL‑specific SQL that CrateDB doesn’t support, switch to the CrateDB JDBC driver for full CrateDB dialect support and smoother integration.

For example, the JDBC catalog integration with Apache Flink depends on CrateDB JDBC, in this case we recommend to use that driver depending on your needs.

The CrateDB JDBC internals page includes more information about compatibility and differences between the two driver variants, and more details about the CrateDB JDBC Driver.

Adapters and drivers

PostgreSQL logo   PostgreSQL JDBC

The PostgreSQL JDBC driver.

PostgreSQL JDBC (pgJDBC)
CrateDB logo   CrateDB JDBC

The CrateDB JDBC driver.

CrateDB JDBC
Hibernate logo   Hibernate

A Hibernate example using Quarkus/Panache.

Hibernate with CrateDB
jOOQ logo   jOOQ

A jOOQ example.

jOOQ with CrateDB
  Software testing

JUnit support and Testcontainers for CrateDB.

Software testing with CrateDB and Java

Frameworks

Flink logo   Apache Flink

Use CrateDB with Apache Flink.

Apache Flink and CrateDB
Spark logo   Apache Spark

Use CrateDB with Apache Spark.

Apache Spark and CrateDB