From 3c3717638472a23b52c88e632921bb0c0601f857 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Thu, 16 Oct 2025 01:59:29 +0200 Subject: [PATCH 01/17] Connect/Java: Add information about jOOQ and Hibernate (JPA/Panache) --- docs/_include/links.md | 3 +++ docs/connect/java.md | 59 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/docs/_include/links.md b/docs/_include/links.md index 5c2eafeb..21385cd8 100644 --- a/docs/_include/links.md +++ b/docs/_include/links.md @@ -35,6 +35,7 @@ [Executable stack with Apache Kafka, Apache Flink, and CrateDB]: https://github.com/crate/cratedb-examples/tree/main/framework/flink/kafka-jdbcsink-java [Geospatial Data Model]: https://cratedb.com/data-model/geospatial [Geospatial Database]: https://cratedb.com/geospatial-spatial-database +[Hibernate]: https://hibernate.org/ [HNSW]: https://en.wikipedia.org/wiki/Hierarchical_navigable_small_world [HNSW paper]: https://arxiv.org/pdf/1603.09320 [HoloViews]: https://www.holoviews.org/ @@ -45,6 +46,8 @@ [inverted index]: https://en.wikipedia.org/wiki/Inverted_index [JDBC]: https://en.wikipedia.org/wiki/Java_Database_Connectivity [JOIN]: inv:crate-reference#sql_joins +[jOOQ]: https://www.jooq.org/ +[JPA]: https://en.wikipedia.org/wiki/Jakarta_Persistence [JSON Database]: https://cratedb.com/solutions/json-database [kNN]: https://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm [LangChain and CrateDB: Code Examples]: https://github.com/crate/cratedb-examples/tree/main/topic/machine-learning/langchain diff --git a/docs/connect/java.md b/docs/connect/java.md index 51ea397a..5fe588b9 100644 --- a/docs/connect/java.md +++ b/docs/connect/java.md @@ -173,7 +173,7 @@ public class Main { ``` ::: -## Example +## JDBC example :::{card} :link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-jdbc @@ -185,7 +185,62 @@ Demonstrates a basic example using both the vanilla PostgreSQL JDBC Driver and the CrateDB JDBC Driver. ::: -## See also +[![Java: JDBC, QA](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml) + +## Hibernate / JPA + +:::{div} +[Hibernate] is the top dog ORM for Java, supporting a range of databases, +including PostgreSQL. [JPA], or Jakarta Persistence API (formerly Java +Persistence API), is a Java specification that simplifies the process of +mapping Java objects to relational databases. +::: + +:::{card} +:link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-quarkus-panache +:link-type: url +{material-outlined}`play_arrow;2em` +Connect to CrateDB and CrateDB Cloud using JPA and Panache. ++++ +How CrateDB can be utilized with Quarkus in a very intuitive way +using the Hibernate ORM deriving from PostgreSQL. +::: + +## jOOQ + +:::{div} +[jOOQ] is an internal DSL and source code generator, modelling the SQL +language as a type-safe Java API to help you write better SQL. +::: + +```java +// Fetch records, with filtering and sorting. +Result result = db.select() + .from(AUTHOR) + .where(AUTHOR.NAME.like("Ja%")) + .orderBy(AUTHOR.NAME) + .fetch(); + +// Iterate and display records. +for (Record record : result) { + Integer id = record.getValue(AUTHOR.ID); + String name = record.getValue(AUTHOR.NAME); + System.out.println("id: " + id + ", name: " + name); +} +``` + +:::{card} +:link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-jooq +:link-type: url +{material-outlined}`play_arrow;2em` +Connect to CrateDB and CrateDB Cloud using jOOQ. ++++ +Java jOOQ demo application with CrateDB using PostgreSQL JDBC. +::: + +[![Java jOOQ](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-jooq.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-jooq.yml) + +## Software testing For testing Java applications against CrateDB, see also documentation about {ref}`java-junit` and {ref}`testcontainers`. From e44ccafa84f51caabf3b94d0fe363179e2de556a Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Wed, 22 Oct 2025 18:26:38 +0200 Subject: [PATCH 02/17] Connect/Java: Reorganize section --- docs/connect/index.md | 2 +- docs/connect/java.md | 246 --------------------------- docs/connect/java/_jdbc_example.md | 13 ++ docs/connect/java/cratedb-jdbc.md | 96 +++++++++++ docs/connect/java/hibernate.md | 27 +++ docs/connect/java/index.md | 105 ++++++++++++ docs/connect/java/jooq.md | 40 +++++ docs/connect/java/postgresql-jdbc.md | 57 +++++++ docs/connect/java/testing.md | 6 + 9 files changed, 345 insertions(+), 247 deletions(-) delete mode 100644 docs/connect/java.md create mode 100644 docs/connect/java/_jdbc_example.md create mode 100644 docs/connect/java/cratedb-jdbc.md create mode 100644 docs/connect/java/hibernate.md create mode 100644 docs/connect/java/index.md create mode 100644 docs/connect/java/jooq.md create mode 100644 docs/connect/java/postgresql-jdbc.md create mode 100644 docs/connect/java/testing.md diff --git a/docs/connect/index.md b/docs/connect/index.md index 3912e98a..c22c8f1a 100644 --- a/docs/connect/index.md +++ b/docs/connect/index.md @@ -176,7 +176,7 @@ application :maxdepth: 1 :hidden: -java +java/index javascript php python diff --git a/docs/connect/java.md b/docs/connect/java.md deleted file mode 100644 index 5fe588b9..00000000 --- a/docs/connect/java.md +++ /dev/null @@ -1,246 +0,0 @@ -(connect-java)= - -# Java - -:::{include} /_include/links.md -::: - -:::{div} sd-text-muted -Java applications mostly use JDBC to connect to CrateDB. -::: - -::: -[JDBC] is a standard Java API that provides a common interface for accessing -databases in Java. -::: - -:::{rubric} Driver options -::: - -:::{div} -You have two JDBC driver options: The [PostgreSQL -JDBC Driver] and the {ref}`crate-jdbc:index`. -PostgreSQL JDBC uses the `jdbc:postgresql://` protocol identifier, -while CrateDB JDBC uses `jdbc:crate://`. -::: - -You are encouraged to probe the PostgreSQL JDBC Driver first. This is the -most convenient option, specifically if the system you are connecting with -already includes the driver jar. - -However, applications using the PostgreSQL JDBC Driver may emit PostgreSQL-specific -SQL that CrateDB does not understand. Use the CrateDB JDBC Driver instead -to ensure compatibility and allow downstream components to handle -CrateDB-specific behavior, for example, by employing a CrateDB-specific -SQL dialect implementation. - -The {ref}`crate-jdbc:internals` page includes more information -about compatibility and differences between the two driver variants, -and more details about the CrateDB JDBC Driver. - - -## PostgreSQL JDBC - -:::{rubric} Synopsis -::: - -```java -Properties properties = new Properties(); -properties.put("user", "admin"); -properties.put("password", ""); -properties.put("ssl", true); -Connection conn = DriverManager.getConnection( - "jdbc:postgresql://.cratedb.net:5432/", - properties -); -``` - -:::{rubric} Maven -::: - -```xml - - org.postgresql - postgresql - 42.7.8 - -``` - -:::{rubric} Gradle -::: - -```groovy -repositories { - mavenCentral() -} -dependencies { - implementation 'org.postgresql:postgresql:42.7.8' -} -``` - -:::{rubric} Download -::: - -:::{card} -:link: https://jdbc.postgresql.org/download/ -:link-type: url -{material-outlined}`download;2em` -Download and install the PostgreSQL JDBC Driver. -::: - -## CrateDB JDBC - -:::{rubric} Synopsis -::: - -```java -Properties properties = new Properties(); -properties.put("user", "admin"); -properties.put("password", ""); -properties.put("ssl", true); -Connection conn = DriverManager.getConnection( - "jdbc:crate://.cratedb.net:5432/", - properties -); -``` - -:::{rubric} Maven -::: - -```xml - - - io.crate - crate-jdbc - 2.7.0 - - -``` - -:::{rubric} Gradle -::: - -```groovy -repositories { - mavenCentral() -} -dependencies { - implementation 'io.crate:crate-jdbc:2.7.0' -} -``` - -:::{rubric} Download -::: - -:::{card} -:link: https://cratedb.com/docs/jdbc/en/latest/getting-started.html#installation -:link-type: url -{material-outlined}`download;2em` -Download and install the CrateDB JDBC Driver. -::: - -:::{rubric} Full example -::: - -:::{dropdown} `main.java` -```java -import java.sql.*; -import java.util.Properties; - -public class Main { - public static void main(String[] args) { - try { - Properties properties = new Properties(); - properties.put("user", "admin"); - properties.put("password", ""); - properties.put("ssl", true); - Connection conn = DriverManager.getConnection( - "jdbc:crate://.cratedb.net:5432/", - properties - ); - - Statement statement = conn.createStatement(); - ResultSet resultSet = statement.executeQuery("SELECT name FROM sys.cluster"); - resultSet.next(); - String name = resultSet.getString("name"); - - System.out.println(name); - } catch (SQLException e) { - e.printStackTrace(); - } - } -} -``` -::: - -## JDBC example - -:::{card} -:link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-jdbc -:link-type: url -{material-outlined}`play_arrow;2em` -Connect to CrateDB and CrateDB Cloud using JDBC. -+++ -Demonstrates a basic example using both the vanilla PostgreSQL JDBC Driver -and the CrateDB JDBC Driver. -::: - -[![Java: JDBC, QA](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml) - -## Hibernate / JPA - -:::{div} -[Hibernate] is the top dog ORM for Java, supporting a range of databases, -including PostgreSQL. [JPA], or Jakarta Persistence API (formerly Java -Persistence API), is a Java specification that simplifies the process of -mapping Java objects to relational databases. -::: - -:::{card} -:link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-quarkus-panache -:link-type: url -{material-outlined}`play_arrow;2em` -Connect to CrateDB and CrateDB Cloud using JPA and Panache. -+++ -How CrateDB can be utilized with Quarkus in a very intuitive way -using the Hibernate ORM deriving from PostgreSQL. -::: - -## jOOQ - -:::{div} -[jOOQ] is an internal DSL and source code generator, modelling the SQL -language as a type-safe Java API to help you write better SQL. -::: - -```java -// Fetch records, with filtering and sorting. -Result result = db.select() - .from(AUTHOR) - .where(AUTHOR.NAME.like("Ja%")) - .orderBy(AUTHOR.NAME) - .fetch(); - -// Iterate and display records. -for (Record record : result) { - Integer id = record.getValue(AUTHOR.ID); - String name = record.getValue(AUTHOR.NAME); - System.out.println("id: " + id + ", name: " + name); -} -``` - -:::{card} -:link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-jooq -:link-type: url -{material-outlined}`play_arrow;2em` -Connect to CrateDB and CrateDB Cloud using jOOQ. -+++ -Java jOOQ demo application with CrateDB using PostgreSQL JDBC. -::: - -[![Java jOOQ](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-jooq.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-jooq.yml) - -## Software testing - -For testing Java applications against CrateDB, see also documentation -about {ref}`java-junit` and {ref}`testcontainers`. diff --git a/docs/connect/java/_jdbc_example.md b/docs/connect/java/_jdbc_example.md new file mode 100644 index 00000000..171d5117 --- /dev/null +++ b/docs/connect/java/_jdbc_example.md @@ -0,0 +1,13 @@ +--- +orphan: true +--- +:::{card} +:link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-jdbc +:link-type: url +:width: 50% +{material-regular}`play_arrow;2em` +Connect to CrateDB using JDBC. ++++ +Demonstrates a basic example using both the vanilla PostgreSQL JDBC Driver +and the CrateDB JDBC Driver. +::: diff --git a/docs/connect/java/cratedb-jdbc.md b/docs/connect/java/cratedb-jdbc.md new file mode 100644 index 00000000..5ced0f86 --- /dev/null +++ b/docs/connect/java/cratedb-jdbc.md @@ -0,0 +1,96 @@ +(crate-jdbc)= +(cratedb-jdbc)= + +# CrateDB JDBC + +:::{rubric} Synopsis +::: + +```java +Properties properties = new Properties(); +properties.put("user", "admin"); +properties.put("password", ""); +properties.put("ssl", true); +Connection conn = DriverManager.getConnection( + "jdbc:crate://.cratedb.net:5432/", + properties +); +``` + +:::{rubric} Maven +::: + +```xml + + + io.crate + crate-jdbc + 2.7.0 + + +``` + +:::{rubric} Gradle +::: + +```groovy +repositories { + mavenCentral() +} +dependencies { + implementation 'io.crate:crate-jdbc:2.7.0' +} +``` + +:::{rubric} Download +::: + +:::{card} +:link: https://cratedb.com/docs/jdbc/en/latest/getting-started.html#installation +:link-type: url +{material-regular}`download;2em` +Download and install the CrateDB JDBC Driver +::: + +:::{rubric} Full example +::: + +:::{dropdown} `main.java` +```java +import java.sql.*; +import java.util.Properties; + +public class Main { + public static void main(String[] args) { + try { + Properties properties = new Properties(); + properties.put("user", "admin"); + properties.put("password", ""); + properties.put("ssl", true); + Connection conn = DriverManager.getConnection( + "jdbc:crate://.cratedb.net:5432/", + properties + ); + + Statement statement = conn.createStatement(); + ResultSet resultSet = statement.executeQuery("SELECT name FROM sys.cluster"); + resultSet.next(); + String name = resultSet.getString("name"); + + System.out.println(name); + } catch (SQLException e) { + e.printStackTrace(); + } + } +} +``` +::: + + +## JDBC example + +:::{include} _jdbc_example.md +::: + + +[![Java: JDBC, QA](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml) diff --git a/docs/connect/java/hibernate.md b/docs/connect/java/hibernate.md new file mode 100644 index 00000000..72da41ab --- /dev/null +++ b/docs/connect/java/hibernate.md @@ -0,0 +1,27 @@ +(jpa)= +(hibernate)= +(panache)= +(quarkus)= + +# Hibernate / JPA + +:::{include} /_include/links.md +::: + +:::{div} +[Hibernate] is the top dog ORM for Java, supporting a range of databases, +including PostgreSQL. [JPA], or Jakarta Persistence API (formerly Java +Persistence API), is a Java specification that simplifies the process of +mapping Java objects to relational databases. +::: + +:::{card} +:link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-quarkus-panache +:link-type: url +:width: 50% +{material-regular}`play_arrow;2em` +Connect to CrateDB using JPA and Panache. ++++ +How CrateDB can be utilized with Quarkus in a very intuitive way +using the Hibernate ORM deriving from PostgreSQL. +::: diff --git a/docs/connect/java/index.md b/docs/connect/java/index.md new file mode 100644 index 00000000..0790a3de --- /dev/null +++ b/docs/connect/java/index.md @@ -0,0 +1,105 @@ +(java)= +(connect-java)= + +# Java + +:::{include} /_include/links.md +::: + +:::{div} sd-text-muted +Java applications mostly use JDBC to connect to CrateDB. +::: + +## Protocols + +### JDBC + +:::{div} +[JDBC] is a standard Java API that provides a common interface for accessing +databases in Java. +::: + +:::{rubric} Driver options +::: + +:::{div} +You have two JDBC driver options: The [PostgreSQL +JDBC Driver] and the {ref}`crate-jdbc:index`. +PostgreSQL JDBC uses the `jdbc:postgresql://` protocol identifier, +while CrateDB JDBC uses `jdbc:crate://`. +::: + +You are encouraged to probe the PostgreSQL JDBC Driver first. This is the +most convenient option, specifically if the system you are connecting with +already includes the driver jar. + +However, applications using the PostgreSQL JDBC Driver may emit PostgreSQL-specific +SQL that CrateDB does not understand. Use the CrateDB JDBC Driver instead +to ensure compatibility and allow downstream components to handle +CrateDB-specific behavior, for example, by employing a CrateDB-specific +SQL dialect implementation. + +The {ref}`crate-jdbc:internals` page includes more information +about compatibility and differences between the two driver variants, +and more details about the CrateDB JDBC Driver. + +### HTTP + +You can also talk to CrateDB using HTTP, using any HTTP library of your choice. +Below is a quick example using Apache Commons HTTP. + + +## Driver list + +:::::{grid} 2 2 2 3 +:gutter: 3 +:padding: 0 + +::::{grid-item-card} {fab}`java;fa-xl` PostgreSQL JDBC +:link: postgresql-jdbc +:link-type: ref +:link-alt: PostgreSQL JDBC (pgJDBC) +The PostgreSQL JDBC driver. +:::: + +::::{grid-item-card} {fab}`java;fa-xl` CrateDB JDBC +:link: cratedb-jdbc +:link-type: ref +:link-alt: CrateDB JDBC +The CrateDB JDBC driver. +:::: + +::::{grid-item-card} {fab}`hibernate` Hibernate +:link: hibernate +:link-type: ref +:link-alt: Hibernate with CrateDB +A Quarkus/Panache example using Hibernate. +:::: + +::::{grid-item-card} {fab}`jooq` jOOQ +:link: hibernate +:link-type: ref +:link-alt: jOOQ with CrateDB +A jOOQ example. +:::: + +::::{grid-item-card} {fab}`junit` Software testing +:link: java-testing +:link-type: ref +:link-alt: Software testing with CrateDB and Java +JUnit and Testcontainers for CrateDB. +:::: + +::::: + +{material-outlined}`apps;2em` + +:::{toctree} +:maxdepth: 1 +:hidden: +postgresql-jdbc +cratedb-jdbc +hibernate +jooq +testing +::: diff --git a/docs/connect/java/jooq.md b/docs/connect/java/jooq.md new file mode 100644 index 00000000..f60cfa79 --- /dev/null +++ b/docs/connect/java/jooq.md @@ -0,0 +1,40 @@ +(jooq)= + +# jOOQ + +:::{include} /_include/links.md +::: + +:::{div} +[jOOQ] is an internal DSL and source code generator, modelling the SQL +language as a type-safe Java API to help you write better SQL. +::: + +```java +// Fetch records, with filtering and sorting. +Result result = db.select() + .from(AUTHOR) + .where(AUTHOR.NAME.like("Ja%")) + .orderBy(AUTHOR.NAME) + .fetch(); + +// Iterate and display records. +for (Record record : result) { + Integer id = record.getValue(AUTHOR.ID); + String name = record.getValue(AUTHOR.NAME); + System.out.println("id: " + id + ", name: " + name); +} +``` + +:::{card} +:link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-jooq +:link-type: url +:width: 50% +{material-regular}`play_arrow;2em` +Connect to CrateDB using jOOQ. ++++ +Java jOOQ demo application with CrateDB using PostgreSQL JDBC. +::: + + +[![Java jOOQ](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-jooq.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-jooq.yml) diff --git a/docs/connect/java/postgresql-jdbc.md b/docs/connect/java/postgresql-jdbc.md new file mode 100644 index 00000000..b7103c78 --- /dev/null +++ b/docs/connect/java/postgresql-jdbc.md @@ -0,0 +1,57 @@ +(pgjdbc)= +(postgresql-jdbc)= + +# PostgreSQL JDBC + +:::{rubric} Synopsis +::: + +```java +Properties properties = new Properties(); +properties.put("user", "admin"); +properties.put("password", ""); +properties.put("ssl", true); +Connection conn = DriverManager.getConnection( + "jdbc:postgresql://.cratedb.net:5432/", + properties +); +``` + +:::{rubric} Maven +::: + +```xml + + org.postgresql + postgresql + 42.7.8 + +``` + +:::{rubric} Gradle +::: + +```groovy +repositories { + mavenCentral() +} +dependencies { + implementation 'org.postgresql:postgresql:42.7.8' +} +``` + +:::{rubric} Download +::: + +:::{card} +:link: https://jdbc.postgresql.org/download/ +:link-type: url +{material-regular}`download;2em` +Download and install the PostgreSQL JDBC Driver +::: + + +## JDBC example + +:::{include} _jdbc_example.md +::: diff --git a/docs/connect/java/testing.md b/docs/connect/java/testing.md new file mode 100644 index 00000000..17e9499c --- /dev/null +++ b/docs/connect/java/testing.md @@ -0,0 +1,6 @@ +(java-testing)= + +# Software testing + +For testing Java applications against CrateDB, see also documentation +about {ref}`java-junit` and {ref}`testcontainers`. From 3dc4006061add2e45ac779f2b50bba251a0f752b Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Wed, 22 Oct 2025 20:23:24 +0200 Subject: [PATCH 03/17] Connect/Java: Provide executable examples for JDBC --- docs/connect/java/cratedb-jdbc.md | 150 +++++++++++++++++---------- docs/connect/java/postgresql-jdbc.md | 115 ++++++++++++++++---- 2 files changed, 193 insertions(+), 72 deletions(-) diff --git a/docs/connect/java/cratedb-jdbc.md b/docs/connect/java/cratedb-jdbc.md index 5ced0f86..2c8bb46b 100644 --- a/docs/connect/java/cratedb-jdbc.md +++ b/docs/connect/java/cratedb-jdbc.md @@ -3,23 +3,111 @@ # CrateDB JDBC +:::{include} /_include/links.md +::: + +:::{div} sd-text-muted +Connect to CrateDB using CrateDB JDBC. +::: + +:::{rubric} About +::: + +:::{div} +The [CrateDB JDBC Driver] is an open-source JDBC driver written in +Pure Java (Type 4), which communicates using the PostgreSQL native +network protocol. +::: + :::{rubric} Synopsis ::: +`example.java` +```java +import java.sql.*; + +void main() throws SQLException { + + // Connect to database. + Properties properties = new Properties(); + properties.put("user", "crate"); + properties.put("password", "crate"); + Connection conn = DriverManager.getConnection( + "jdbc:crate://localhost:5432/doc?sslmode=disable", + properties + ); + conn.setAutoCommit(true); + + // Invoke query. + Statement st = conn.createStatement(); + st.execute("SELECT mountain, height FROM sys.summits ORDER BY height DESC LIMIT 5;"); + + // Display results. + ResultSet rs = st.getResultSet(); + while (rs.next()) { + System.out.printf(Locale.ENGLISH, "%s: %d\n", rs.getString(1), rs.getInt(2)); + } + conn.close(); + +} +``` + +:::{include} ../_cratedb.md +::: +Download JAR file. +```shell +wget https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar +``` +:::{dropdown} Instructions for Windows users +If you don't have the `wget` program installed, for example on Windows, just +download the JAR file using your web browser of choice. +If you want to use PowerShell, invoke the `Invoke-WebRequest` command instead +of `wget`. +```powershell +Invoke-WebRequest https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar -OutFile crate-jdbc-standalone-2.7.0.jar +``` +::: +Invoke program. Needs Java >= 25 ([JEP 330]). +```shell +java -cp crate-jdbc-standalone-2.7.0.jar example.java +``` + +:::{rubric} CrateDB Cloud +::: + +For connecting to CrateDB Cloud, use the `sslmode=require` parameter, +and replace username, password, and hostname with values matching +your environment. ```java -Properties properties = new Properties(); properties.put("user", "admin"); -properties.put("password", ""); -properties.put("ssl", true); +properties.put("password", "password"); Connection conn = DriverManager.getConnection( - "jdbc:crate://.cratedb.net:5432/", + "jdbc:crate://testcluster.cratedb.net:5432/doc?sslmode=require", properties ); ``` -:::{rubric} Maven +## Install + +:::{rubric} Download +::: + +:::{card} +:link: https://cratedb.com/docs/jdbc/en/latest/getting-started.html#installation +:link-type: url +{material-regular}`download;2em` +Navigate to the CrateDB JDBC Driver installation page. +::: + +:::{card} +:link: https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar +:link-type: url +{material-regular}`download;2em` +Directly download the recommended `crate-jdbc-standalone-2.7.0.jar`. ::: +:::{rubric} Maven `pom.xml` +::: ```xml @@ -30,9 +118,8 @@ Connection conn = DriverManager.getConnection( ``` -:::{rubric} Gradle +:::{rubric} Gradle `build.gradle` ::: - ```groovy repositories { mavenCentral() @@ -42,55 +129,10 @@ dependencies { } ``` -:::{rubric} Download -::: - -:::{card} -:link: https://cratedb.com/docs/jdbc/en/latest/getting-started.html#installation -:link-type: url -{material-regular}`download;2em` -Download and install the CrateDB JDBC Driver -::: - -:::{rubric} Full example -::: - -:::{dropdown} `main.java` -```java -import java.sql.*; -import java.util.Properties; - -public class Main { - public static void main(String[] args) { - try { - Properties properties = new Properties(); - properties.put("user", "admin"); - properties.put("password", ""); - properties.put("ssl", true); - Connection conn = DriverManager.getConnection( - "jdbc:crate://.cratedb.net:5432/", - properties - ); - - Statement statement = conn.createStatement(); - ResultSet resultSet = statement.executeQuery("SELECT name FROM sys.cluster"); - resultSet.next(); - String name = resultSet.getString("name"); - - System.out.println(name); - } catch (SQLException e) { - e.printStackTrace(); - } - } -} -``` -::: - - -## JDBC example +## Full example :::{include} _jdbc_example.md ::: -[![Java: JDBC, QA](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml) +[JEP 330]: https://openjdk.org/jeps/330 diff --git a/docs/connect/java/postgresql-jdbc.md b/docs/connect/java/postgresql-jdbc.md index b7103c78..2a9addce 100644 --- a/docs/connect/java/postgresql-jdbc.md +++ b/docs/connect/java/postgresql-jdbc.md @@ -3,23 +3,111 @@ # PostgreSQL JDBC +:::{include} /_include/links.md +::: + +:::{div} sd-text-muted +Connect to CrateDB using PostgreSQL JDBC. +::: + +:::{rubric} About +::: + +:::{div} +The [PostgreSQL JDBC Driver] is an open-source JDBC driver written in +Pure Java (Type 4), which communicates using the PostgreSQL native +network protocol. +::: + :::{rubric} Synopsis ::: +`example.java` +```java +import java.sql.*; + +void main() throws SQLException { + + // Connect to database. + Properties properties = new Properties(); + properties.put("user", "crate"); + properties.put("password", "crate"); + Connection conn = DriverManager.getConnection( + "jdbc:postgresql://localhost:5432/doc?sslmode=disable", + properties + ); + conn.setAutoCommit(true); + + // Invoke query. + Statement st = conn.createStatement(); + st.execute("SELECT mountain, height FROM sys.summits ORDER BY height DESC LIMIT 5;"); + + // Display results. + ResultSet rs = st.getResultSet(); + while (rs.next()) { + System.out.printf(Locale.ENGLISH, "%s: %d\n", rs.getString(1), rs.getInt(2)); + } + conn.close(); + +} +``` + +:::{include} ../_cratedb.md +::: +Download JAR file. +```shell +wget https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar +``` +:::{dropdown} Instructions for Windows users +If you don't have the `wget` program installed, for example on Windows, just +download the JAR file using your web browser of choice. +If you want to use PowerShell, invoke the `Invoke-WebRequest` command instead +of `wget`. +```powershell +Invoke-WebRequest https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar -OutFile postgresql-42.7.8.jar +``` +::: +Invoke program. Needs Java >= 25 ([JEP 330]). +```shell +java -cp postgresql-42.7.8.jar example.java +``` + +:::{rubric} CrateDB Cloud +::: + +For connecting to CrateDB Cloud, use the `sslmode=require` parameter, +and replace username, password, and hostname with values matching +your environment. ```java -Properties properties = new Properties(); properties.put("user", "admin"); -properties.put("password", ""); -properties.put("ssl", true); +properties.put("password", "password"); Connection conn = DriverManager.getConnection( - "jdbc:postgresql://.cratedb.net:5432/", + "jdbc:postgresql://testcluster.cratedb.net:5432/doc?sslmode=require", properties ); ``` -:::{rubric} Maven +## Install + +:::{rubric} Download +::: + +:::{card} +:link: https://jdbc.postgresql.org/download/ +:link-type: url +{material-regular}`download;2em` +Navigate to the PostgreSQL JDBC Driver installation page. +::: + +:::{card} +:link: https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar +:link-type: url +{material-regular}`download;2em` +Directly download the recommended `postgresql-42.7.8.jar`. ::: +:::{rubric} Maven `pom.xml` +::: ```xml org.postgresql @@ -28,9 +116,8 @@ Connection conn = DriverManager.getConnection( ``` -:::{rubric} Gradle +:::{rubric} Gradle `build.gradle` ::: - ```groovy repositories { mavenCentral() @@ -40,18 +127,10 @@ dependencies { } ``` -:::{rubric} Download -::: +## Full example -:::{card} -:link: https://jdbc.postgresql.org/download/ -:link-type: url -{material-regular}`download;2em` -Download and install the PostgreSQL JDBC Driver +:::{include} _jdbc_example.md ::: -## JDBC example - -:::{include} _jdbc_example.md -::: +[JEP 330]: https://openjdk.org/jeps/330 From 1469f4aa16f6da864fef783af9efb619f39ae9d7 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Wed, 22 Oct 2025 21:36:07 +0200 Subject: [PATCH 04/17] Connect/Java: Refurbish landing page --- docs/_include/logos.md | 8 ++++++ docs/connect/java/index.md | 55 +++++++++++++++++++++----------------- 2 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 docs/_include/logos.md diff --git a/docs/_include/logos.md b/docs/_include/logos.md new file mode 100644 index 00000000..a79432e6 --- /dev/null +++ b/docs/_include/logos.md @@ -0,0 +1,8 @@ + + + +[CrateDB logo]: https://avatars.githubusercontent.com/u/4048232?s=200&v=4 +[Hibernate logo]: https://logo.svgcdn.com/devicon/hibernate-original.svg +[jOOQ logo]: https://www.jooq.org/img/jooq-logo-black.png +[JUnit logo]: https://avatars.githubusercontent.com/u/874086?s=200&v=4 +[PostgreSQL logo]: https://jdbc.postgresql.org/icons/postgreslogo.svg diff --git a/docs/connect/java/index.md b/docs/connect/java/index.md index 0790a3de..b408e7ec 100644 --- a/docs/connect/java/index.md +++ b/docs/connect/java/index.md @@ -5,17 +5,17 @@ :::{include} /_include/links.md ::: +:::{include} /_include/logos.md +::: :::{div} sd-text-muted -Java applications mostly use JDBC to connect to CrateDB. +Connect to CrateDB and CrateDB Cloud from Java. ::: -## Protocols - -### JDBC +## JDBC :::{div} -[JDBC] is a standard Java API that provides a common interface for accessing +[JDBC] is the standard Java API that provides a common interface for accessing databases in Java. ::: @@ -23,67 +23,64 @@ databases in Java. ::: :::{div} -You have two JDBC driver options: The [PostgreSQL -JDBC Driver] and the {ref}`crate-jdbc:index`. +You have two JDBC driver options: The {ref}`postgresql-jdbc` Driver +and the {ref}`cratedb-jdbc` Driver. PostgreSQL JDBC uses the `jdbc:postgresql://` protocol identifier, while CrateDB JDBC uses `jdbc:crate://`. ::: You are encouraged to probe the PostgreSQL JDBC Driver first. This is the most convenient option, specifically if the system you are connecting with -already includes the driver jar. +already includes the PostgreSQL driver JAR file, and you can't change it. However, applications using the PostgreSQL JDBC Driver may emit PostgreSQL-specific -SQL that CrateDB does not understand. Use the CrateDB JDBC Driver instead +SQL that CrateDB does not understand, while the framework assumes the +database would understand the PostgreSQL dialect completely. +In this case, use the CrateDB JDBC Driver instead to ensure compatibility and allow downstream components to handle CrateDB-specific behavior, for example, by employing a CrateDB-specific -SQL dialect implementation. +SQL dialect implementation for their purposes and realms. The {ref}`crate-jdbc:internals` page includes more information about compatibility and differences between the two driver variants, and more details about the CrateDB JDBC Driver. -### HTTP - -You can also talk to CrateDB using HTTP, using any HTTP library of your choice. -Below is a quick example using Apache Commons HTTP. - - -## Driver list +:::{rubric} Adapters and drivers +::: :::::{grid} 2 2 2 3 -:gutter: 3 +:gutter: 2 :padding: 0 -::::{grid-item-card} {fab}`java;fa-xl` PostgreSQL JDBC +::::{grid-item-card} ![PostgreSQL logo][PostgreSQL logo]{height=40px}   PostgreSQL JDBC :link: postgresql-jdbc :link-type: ref :link-alt: PostgreSQL JDBC (pgJDBC) The PostgreSQL JDBC driver. :::: -::::{grid-item-card} {fab}`java;fa-xl` CrateDB JDBC +::::{grid-item-card} ![CrateDB logo][CrateDB logo]{height=40px}   CrateDB JDBC :link: cratedb-jdbc :link-type: ref :link-alt: CrateDB JDBC The CrateDB JDBC driver. :::: -::::{grid-item-card} {fab}`hibernate` Hibernate +::::{grid-item-card} ![Hibernate logo][Hibernate logo]{height=40px}   Hibernate :link: hibernate :link-type: ref :link-alt: Hibernate with CrateDB A Quarkus/Panache example using Hibernate. :::: -::::{grid-item-card} {fab}`jooq` jOOQ -:link: hibernate +::::{grid-item-card} ![jOOQ logo][jOOQ logo]{height=40px}   jOOQ +:link: jooq :link-type: ref :link-alt: jOOQ with CrateDB A jOOQ example. :::: -::::{grid-item-card} {fab}`junit` Software testing +::::{grid-item-card} ![JUnit logo][JUnit logo]{height=40px}   Software testing :link: java-testing :link-type: ref :link-alt: Software testing with CrateDB and Java @@ -92,7 +89,15 @@ JUnit and Testcontainers for CrateDB. ::::: -{material-outlined}`apps;2em` +## HTTP + +You can also talk to CrateDB using HTTP, using any HTTP library of your choice. +Below is a quick example using Apache Commons HTTP. + +:::{todo} +Add example. +::: + :::{toctree} :maxdepth: 1 From 184d205582e26677a3014a163fe8ce402c46e371 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Wed, 22 Oct 2025 22:44:25 +0200 Subject: [PATCH 05/17] Connect/Java: Concise driver recommendations as suggested by CodeRabbit --- docs/connect/java/index.md | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/docs/connect/java/index.md b/docs/connect/java/index.md index b408e7ec..0c202ac3 100644 --- a/docs/connect/java/index.md +++ b/docs/connect/java/index.md @@ -22,24 +22,15 @@ databases in Java. :::{rubric} Driver options ::: -:::{div} -You have two JDBC driver options: The {ref}`postgresql-jdbc` Driver -and the {ref}`cratedb-jdbc` Driver. -PostgreSQL JDBC uses the `jdbc:postgresql://` protocol identifier, -while CrateDB JDBC uses `jdbc:crate://`. -::: +Choose one of two JDBC drivers: + +- {ref}`postgresql-jdbc` — `jdbc:postgresql://` +- {ref}`cratedb-jdbc` — `jdbc:crate://` -You are encouraged to probe the PostgreSQL JDBC Driver first. This is the -most convenient option, specifically if the system you are connecting with -already includes the PostgreSQL driver JAR file, and you can't change it. - -However, applications using the PostgreSQL JDBC Driver may emit PostgreSQL-specific -SQL that CrateDB does not understand, while the framework assumes the -database would understand the PostgreSQL dialect completely. -In this case, use the CrateDB JDBC Driver instead -to ensure compatibility and allow downstream components to handle -CrateDB-specific behavior, for example, by employing a CrateDB-specific -SQL dialect implementation for their purposes and realms. +Prefer the PostgreSQL JDBC driver first—it’s often already on 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. The {ref}`crate-jdbc:internals` page includes more information about compatibility and differences between the two driver variants, From ff18c5bf13c2ad4f30d38f3ac2c4bf9aa77574d8 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 25 Oct 2025 23:28:37 +0200 Subject: [PATCH 06/17] Connect/Java: Absorb content about software testing --- docs/_include/logos.md | 3 ++ docs/connect/java/index.md | 4 +- docs/connect/java/testing.md | 76 ++++++++++++++++++++++++++++++++- docs/install/container/index.md | 1 + docs/topic/testing/index.md | 41 +++++++++--------- 5 files changed, 101 insertions(+), 24 deletions(-) diff --git a/docs/_include/logos.md b/docs/_include/logos.md index a79432e6..d65c7059 100644 --- a/docs/_include/logos.md +++ b/docs/_include/logos.md @@ -4,5 +4,8 @@ [CrateDB logo]: https://avatars.githubusercontent.com/u/4048232?s=200&v=4 [Hibernate logo]: https://logo.svgcdn.com/devicon/hibernate-original.svg [jOOQ logo]: https://www.jooq.org/img/jooq-logo-black.png +[JUnit home]: https://junit.org/ [JUnit logo]: https://avatars.githubusercontent.com/u/874086?s=200&v=4 [PostgreSQL logo]: https://jdbc.postgresql.org/icons/postgreslogo.svg +[Testcontainers for Java]: https://testcontainers.com/guides/getting-started-with-testcontainers-for-java/ +[Testcontainers logo]: https://avatars.githubusercontent.com/u/13393021?s=200&v=4 diff --git a/docs/connect/java/index.md b/docs/connect/java/index.md index 0c202ac3..8d0bd524 100644 --- a/docs/connect/java/index.md +++ b/docs/connect/java/index.md @@ -71,11 +71,11 @@ A Quarkus/Panache example using Hibernate. A jOOQ example. :::: -::::{grid-item-card} ![JUnit logo][JUnit logo]{height=40px}   Software testing +::::{grid-item-card} {material-outlined}`verified;2em`   Software testing :link: java-testing :link-type: ref :link-alt: Software testing with CrateDB and Java -JUnit and Testcontainers for CrateDB. +JUnit support and Testcontainers for CrateDB. :::: ::::: diff --git a/docs/connect/java/testing.md b/docs/connect/java/testing.md index 17e9499c..16beb6ef 100644 --- a/docs/connect/java/testing.md +++ b/docs/connect/java/testing.md @@ -1,6 +1,78 @@ +:::{include} /_include/logos.md +::: + (java-testing)= # Software testing -For testing Java applications against CrateDB, see also documentation -about {ref}`java-junit` and {ref}`testcontainers`. +```{div} .float-right +[![JUnit logo][JUnit logo]{height=60px loading=lazy}][JUnit home] +[![Testcontainers logo][Testcontainers logo]{height=60px loading=lazy}][Testcontainers for Java] +``` +:::{div} sd-text-muted +Testing Java applications against CrateDB. +::: +```{div} .clearfix +``` + +(junit)= +(java-junit)= +## JUnit + +The popular [JUnit] framework is supported by *CrateDB Java Testing Classes*. +The package includes `CrateTestServer` and `CrateTestCluster` classes for use +as [JUnit external resources]. Both classes download and start CrateDB before +test execution, and stop CrateDB afterwards. + +:::::{grid} +::::{grid-item} + +:Package: `io.crate:crate-testing` +:Download: [io.crate:crate-testing] (Maven Central) +:Repository: [crate-java-testing] +:::: +::::{grid-item} +:::{card} Using JUnit "crate-testing" with CrateDB +:link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-qa +This example project uses the `io.crate:crate-testing` package and includes a +corresponding project setup that you can use right away to get started. +::: +:::: +::::: + +(testcontainers-java)= +## Testcontainers + +[Testcontainers] is an open source framework for providing throwaway, +lightweight instances of databases, message brokers, web browsers, or +just about anything that can run in a Docker container. +CrateDB provides Testcontainers implementations for both Java and Python +which are using its {ref}`OCI container image `. + +:::::{grid} +::::{grid-item} + +:Package: `org.testcontainers:testcontainers-cratedb` +:Download: [org.testcontainers:testcontainers-cratedb] (Maven Central) +:Repository: [testcontainers-cratedb sources] +:Documentation: [Testcontainers CrateDB Module] +:::: +::::{grid-item} +:::{card} Using "Testcontainers for Java" with CrateDB +:link: https://github.com/crate/cratedb-examples/tree/main/testing/testcontainers/java +This example project uses the `testcontainers-cratedb` package and includes a +corresponding project setup that you can use right away to get started. +::: +:::: +::::: + + +[crate-java-testing]: https://github.com/crate/crate-java-testing +[JUnit]: https://junit.org/ +[JUnit external resources]: https://github.com/junit-team/junit4/wiki/Rules#externalresource-rules +[Testcontainers]: https://testcontainers.com/ +[Testcontainers CrateDB Module]: https://java.testcontainers.org/modules/databases/cratedb/ +[testcontainers-cratedb sources]: https://github.com/testcontainers/testcontainers-java/tree/main/modules/cratedb/src/main/java/org/testcontainers/cratedb + +[io.crate:crate-testing]: https://repo1.maven.org/maven2/io/crate/crate-testing/ +[org.testcontainers:testcontainers-cratedb]: https://repo1.maven.org/maven2/org/testcontainers/testcontainers-cratedb/ diff --git a/docs/install/container/index.md b/docs/install/container/index.md index 847c0bc3..9d8872ec 100644 --- a/docs/install/container/index.md +++ b/docs/install/container/index.md @@ -1,3 +1,4 @@ +(oci)= (install-container)= # Container setup diff --git a/docs/topic/testing/index.md b/docs/topic/testing/index.md index 17a5fb31..228cb297 100644 --- a/docs/topic/testing/index.md +++ b/docs/topic/testing/index.md @@ -1,27 +1,35 @@ (testing)= -# Software Testing +# Software testing + +:::{include} /_include/logos.md +::: :::{div} sd-text-muted Test frameworks and libraries that support software integration testing with CrateDB. ::: -(java-junit)= -## Java JUnit - -The popular [JUnit] framework is supported by *CrateDB Java Testing Classes*, -provided per [io.crate:crate-testing] package available on Maven Central. -Its source code is maintained within the [crate-java-testing] repository on GitHub. +## Java -The package includes `CrateTestServer` and `CrateTestCluster` classes for use -as [JUnit external resources]. Both classes download and start CrateDB before -test execution, and stop CrateDB afterwards. +:::::{grid} 2 2 2 3 +:gutter: 2 +:padding: 0 -This example project includes a corresponding setup that you can use right away -to get started. +::::{grid-item-card} ![JUnit logo][JUnit logo]{height=40px loading=lazy}   JUnit +:link: junit +:link-type: ref +:link-alt: Use JUnit with CrateDB +Use JUnit with CrateDB. +:::: -- [Using "crate-testing" with CrateDB and JUnit] +::::{grid-item-card} ![Testcontainers logo][Testcontainers logo]{height=40px loading=lazy}   Testcontainers for Java +:link: testcontainers-java +:link-type: ref +:link-alt: Use Testcontainers for Java with CrateDB +Use Testcontainers for Java with CrateDB. +:::: +::::: (python-pytest)= ## Python pytest @@ -59,24 +67,17 @@ just about anything that can run in a Docker container. CrateDB provides Testcontainers implementations for both Java and Python. -- [Using "Testcontainers for Java" with CrateDB] - [Using "Testcontainers for Python" with CrateDB and pytest] - [Using "Testcontainers for Python" with CrateDB and unittest] [cr8]: https://pypi.org/project/cr8/ -[crate-java-testing]: https://github.com/crate/crate-java-testing -[io.crate:crate-testing]: https://repo1.maven.org/maven2/io/crate/crate-testing/ -[JUnit]: https://en.wikipedia.org/wiki/JUnit -[JUnit external resources]: https://github.com/junit-team/junit4/wiki/Rules#externalresource-rules [pytest]: https://docs.pytest.org/ [pytest-cratedb]: https://pypi.org/project/pytest-cratedb/ [run-crate]: https://pypi.org/project/cr8/#run-crate [Testcontainers]: https://testcontainers.com/ [unittest]: https://docs.python.org/3/library/unittest.html [Using "cr8" test layers with CrateDB and unittest]: https://github.com/crate/cratedb-examples/tree/main/testing/native/python-unittest -[Using "crate-testing" with CrateDB and JUnit]: https://github.com/crate/cratedb-examples/tree/main/by-language/java-qa [Using "pytest-cratedb" with CrateDB and pytest]: https://github.com/crate/cratedb-examples/tree/main/testing/native/python-pytest -[Using "Testcontainers for Java" with CrateDB]: https://github.com/crate/cratedb-examples/tree/main/testing/testcontainers/java [Using "Testcontainers for Python" with CrateDB and pytest]: https://github.com/crate/cratedb-examples/tree/main/testing/testcontainers/python-pytest [Using "Testcontainers for Python" with CrateDB and unittest]: https://github.com/crate/cratedb-examples/tree/main/testing/testcontainers/python-unittest From 59b8ea3cc46cc0883e7c1bca2731bdc7c3e491c3 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 25 Oct 2025 23:42:35 +0200 Subject: [PATCH 07/17] Connect/Java: Wording. Clean up. --- docs/connect/java/index.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/docs/connect/java/index.md b/docs/connect/java/index.md index 8d0bd524..c589130a 100644 --- a/docs/connect/java/index.md +++ b/docs/connect/java/index.md @@ -27,12 +27,12 @@ Choose one of two JDBC drivers: - {ref}`postgresql-jdbc` — `jdbc:postgresql://` - {ref}`cratedb-jdbc` — `jdbc:crate://` -Prefer the PostgreSQL JDBC driver first—it’s often already on your classpath +Prefer the PostgreSQL JDBC driver first, it’s 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. -The {ref}`crate-jdbc:internals` page includes more information +The {ref}`CrateDB JDBC internals ` page includes more information about compatibility and differences between the two driver variants, and more details about the CrateDB JDBC Driver. @@ -61,7 +61,7 @@ The CrateDB JDBC driver. :link: hibernate :link-type: ref :link-alt: Hibernate with CrateDB -A Quarkus/Panache example using Hibernate. +A Hibernate example using Quarkus/Panache. :::: ::::{grid-item-card} ![jOOQ logo][jOOQ logo]{height=40px}   jOOQ @@ -80,14 +80,6 @@ JUnit support and Testcontainers for CrateDB. ::::: -## HTTP - -You can also talk to CrateDB using HTTP, using any HTTP library of your choice. -Below is a quick example using Apache Commons HTTP. - -:::{todo} -Add example. -::: :::{toctree} From 0fff8740b2bcfae61862d9e32d6891444198c052 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 25 Oct 2025 23:44:04 +0200 Subject: [PATCH 08/17] Connect/Java: Clarify JDBC examples need Java 21 (JEP 330 => JEP 445) Previously, the docs stated Java 25 would be required, which isn't true. --- docs/_include/logos.md | 2 ++ docs/connect/java/cratedb-jdbc.md | 15 ++++++++++++--- docs/connect/java/postgresql-jdbc.md | 15 ++++++++++++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/docs/_include/logos.md b/docs/_include/logos.md index d65c7059..2b1d6ad7 100644 --- a/docs/_include/logos.md +++ b/docs/_include/logos.md @@ -1,11 +1,13 @@ +[CrateDB home]: https://cratedb.com/ [CrateDB logo]: https://avatars.githubusercontent.com/u/4048232?s=200&v=4 [Hibernate logo]: https://logo.svgcdn.com/devicon/hibernate-original.svg [jOOQ logo]: https://www.jooq.org/img/jooq-logo-black.png [JUnit home]: https://junit.org/ [JUnit logo]: https://avatars.githubusercontent.com/u/874086?s=200&v=4 +[PostgreSQL home]: https://www.postgresql.org/ [PostgreSQL logo]: https://jdbc.postgresql.org/icons/postgreslogo.svg [Testcontainers for Java]: https://testcontainers.com/guides/getting-started-with-testcontainers-for-java/ [Testcontainers logo]: https://avatars.githubusercontent.com/u/13393021?s=200&v=4 diff --git a/docs/connect/java/cratedb-jdbc.md b/docs/connect/java/cratedb-jdbc.md index 2c8bb46b..1ffae87b 100644 --- a/docs/connect/java/cratedb-jdbc.md +++ b/docs/connect/java/cratedb-jdbc.md @@ -1,8 +1,17 @@ +:::{include} /_include/logos.md +::: + (crate-jdbc)= (cratedb-jdbc)= # CrateDB JDBC +```{div} .float-right +[![CrateDB logo][CrateDB logo]{height=40px loading=lazy}][CrateDB home] +``` +```{div} .clearfix +``` + :::{include} /_include/links.md ::: @@ -16,7 +25,7 @@ Connect to CrateDB using CrateDB JDBC. :::{div} The [CrateDB JDBC Driver] is an open-source JDBC driver written in Pure Java (Type 4), which communicates using the PostgreSQL native -network protocol. +network protocol. CrateDB JDBC needs Java >= 11. ::: :::{rubric} Synopsis @@ -67,7 +76,7 @@ of `wget`. Invoke-WebRequest https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar -OutFile crate-jdbc-standalone-2.7.0.jar ``` ::: -Invoke program. Needs Java >= 25 ([JEP 330]). +Invoke program. Needs Java >= 21 ([JEP 445]), alternatively see [](#full-example). ```shell java -cp crate-jdbc-standalone-2.7.0.jar example.java ``` @@ -135,4 +144,4 @@ dependencies { ::: -[JEP 330]: https://openjdk.org/jeps/330 +[JEP 445]: https://openjdk.org/jeps/445 diff --git a/docs/connect/java/postgresql-jdbc.md b/docs/connect/java/postgresql-jdbc.md index 2a9addce..990ebe4c 100644 --- a/docs/connect/java/postgresql-jdbc.md +++ b/docs/connect/java/postgresql-jdbc.md @@ -1,8 +1,17 @@ +:::{include} /_include/logos.md +::: + (pgjdbc)= (postgresql-jdbc)= # PostgreSQL JDBC +```{div} .float-right +[![PostgreSQL logo][PostgreSQL logo]{height=40px loading=lazy}][PostgreSQL home] +``` +```{div} .clearfix +``` + :::{include} /_include/links.md ::: @@ -16,7 +25,7 @@ Connect to CrateDB using PostgreSQL JDBC. :::{div} The [PostgreSQL JDBC Driver] is an open-source JDBC driver written in Pure Java (Type 4), which communicates using the PostgreSQL native -network protocol. +network protocol. PostgreSQL JDBC needs Java >= 8. ::: :::{rubric} Synopsis @@ -67,7 +76,7 @@ of `wget`. Invoke-WebRequest https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar -OutFile postgresql-42.7.8.jar ``` ::: -Invoke program. Needs Java >= 25 ([JEP 330]). +Invoke program. Needs Java >= 21 ([JEP 445]), alternatively see [](#full-example). ```shell java -cp postgresql-42.7.8.jar example.java ``` @@ -133,4 +142,4 @@ dependencies { ::: -[JEP 330]: https://openjdk.org/jeps/330 +[JEP 445]: https://openjdk.org/jeps/445 From dcce1702e728a8e289d97efd7fd0fb342d5ef63b Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 25 Oct 2025 23:49:41 +0200 Subject: [PATCH 09/17] Connect/Java: Reorganize JDBC pages --- docs/connect/java/cratedb-jdbc.md | 45 +++++++++++++++------------- docs/connect/java/postgresql-jdbc.md | 44 ++++++++++++++------------- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/docs/connect/java/cratedb-jdbc.md b/docs/connect/java/cratedb-jdbc.md index 1ffae87b..ca51d50c 100644 --- a/docs/connect/java/cratedb-jdbc.md +++ b/docs/connect/java/cratedb-jdbc.md @@ -61,26 +61,6 @@ void main() throws SQLException { } ``` -:::{include} ../_cratedb.md -::: -Download JAR file. -```shell -wget https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar -``` -:::{dropdown} Instructions for Windows users -If you don't have the `wget` program installed, for example on Windows, just -download the JAR file using your web browser of choice. -If you want to use PowerShell, invoke the `Invoke-WebRequest` command instead -of `wget`. -```powershell -Invoke-WebRequest https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar -OutFile crate-jdbc-standalone-2.7.0.jar -``` -::: -Invoke program. Needs Java >= 21 ([JEP 445]), alternatively see [](#full-example). -```shell -java -cp crate-jdbc-standalone-2.7.0.jar example.java -``` - :::{rubric} CrateDB Cloud ::: @@ -138,6 +118,31 @@ dependencies { } ``` +## Quickstart example + +Create a file `example.java` including the synopsis code shared above. + +:::{include} ../_cratedb.md +::: +Download JAR file. +```shell +wget https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar +``` +:::{dropdown} Instructions for Windows users +If you don't have the `wget` program installed, for example on Windows, just +download the JAR file using your web browser of choice. +If you want to use PowerShell, invoke the `Invoke-WebRequest` command instead +of `wget`. +```powershell +Invoke-WebRequest https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar -OutFile crate-jdbc-standalone-2.7.0.jar +``` +::: +Invoke program. Needs Java >= 21 ([JEP 445]), alternatively see [](#full-example). +```shell +java -cp crate-jdbc-standalone-2.7.0.jar example.java +``` + + ## Full example :::{include} _jdbc_example.md diff --git a/docs/connect/java/postgresql-jdbc.md b/docs/connect/java/postgresql-jdbc.md index 990ebe4c..93fb423b 100644 --- a/docs/connect/java/postgresql-jdbc.md +++ b/docs/connect/java/postgresql-jdbc.md @@ -61,26 +61,6 @@ void main() throws SQLException { } ``` -:::{include} ../_cratedb.md -::: -Download JAR file. -```shell -wget https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar -``` -:::{dropdown} Instructions for Windows users -If you don't have the `wget` program installed, for example on Windows, just -download the JAR file using your web browser of choice. -If you want to use PowerShell, invoke the `Invoke-WebRequest` command instead -of `wget`. -```powershell -Invoke-WebRequest https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar -OutFile postgresql-42.7.8.jar -``` -::: -Invoke program. Needs Java >= 21 ([JEP 445]), alternatively see [](#full-example). -```shell -java -cp postgresql-42.7.8.jar example.java -``` - :::{rubric} CrateDB Cloud ::: @@ -136,6 +116,30 @@ dependencies { } ``` +## Quickstart example + +Create a file `example.java` including the synopsis code shared above. + +:::{include} ../_cratedb.md +::: +Download JAR file. +```shell +wget https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar +``` +:::{dropdown} Instructions for Windows users +If you don't have the `wget` program installed, for example on Windows, just +download the JAR file using your web browser of choice. +If you want to use PowerShell, invoke the `Invoke-WebRequest` command instead +of `wget`. +```powershell +Invoke-WebRequest https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar -OutFile postgresql-42.7.8.jar +``` +::: +Invoke program. Needs Java >= 21 ([JEP 445]), alternatively see [](#full-example). +```shell +java -cp postgresql-42.7.8.jar example.java +``` + ## Full example :::{include} _jdbc_example.md From eeec86ea5db990d92201c776ec77bfc9578c96fd Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 25 Oct 2025 23:59:33 +0200 Subject: [PATCH 10/17] Connect/Java: Implement suggestions by CodeRabbit --- docs/connect/java/testing.md | 4 ++-- docs/topic/testing/index.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/connect/java/testing.md b/docs/connect/java/testing.md index 16beb6ef..12f98970 100644 --- a/docs/connect/java/testing.md +++ b/docs/connect/java/testing.md @@ -22,7 +22,7 @@ Testing Java applications against CrateDB. The popular [JUnit] framework is supported by *CrateDB Java Testing Classes*. The package includes `CrateTestServer` and `CrateTestCluster` classes for use as [JUnit external resources]. Both classes download and start CrateDB before -test execution, and stop CrateDB afterwards. +test execution, and stop CrateDB afterward. :::::{grid} ::::{grid-item} @@ -43,7 +43,7 @@ corresponding project setup that you can use right away to get started. (testcontainers-java)= ## Testcontainers -[Testcontainers] is an open source framework for providing throwaway, +[Testcontainers] is an open-source framework for providing throwaway, lightweight instances of databases, message brokers, web browsers, or just about anything that can run in a Docker container. CrateDB provides Testcontainers implementations for both Java and Python diff --git a/docs/topic/testing/index.md b/docs/topic/testing/index.md index 228cb297..139ae22c 100644 --- a/docs/topic/testing/index.md +++ b/docs/topic/testing/index.md @@ -1,5 +1,5 @@ (testing)= -# Software testing +# Software Testing :::{include} /_include/logos.md ::: From ba1ed79327d6d05d028c813a3fd00b69f11d76fa Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 26 Oct 2025 00:27:47 +0200 Subject: [PATCH 11/17] Connect/Java: Clarify JDBC examples need Java 25 (JEP 445 => JEP 512) Previously, the docs stated Java 21 would be okay, which isn't true. --- docs/connect/java/cratedb-jdbc.md | 5 +++-- docs/connect/java/postgresql-jdbc.md | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/connect/java/cratedb-jdbc.md b/docs/connect/java/cratedb-jdbc.md index ca51d50c..428147d5 100644 --- a/docs/connect/java/cratedb-jdbc.md +++ b/docs/connect/java/cratedb-jdbc.md @@ -137,7 +137,8 @@ of `wget`. Invoke-WebRequest https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar -OutFile crate-jdbc-standalone-2.7.0.jar ``` ::: -Invoke program. Needs Java >= 21 ([JEP 445]), alternatively see [](#full-example). +Invoke program. This example needs Java >= 25 ([JEP 512]), +with earlier versions please use the [](#full-example). ```shell java -cp crate-jdbc-standalone-2.7.0.jar example.java ``` @@ -149,4 +150,4 @@ java -cp crate-jdbc-standalone-2.7.0.jar example.java ::: -[JEP 445]: https://openjdk.org/jeps/445 +[JEP 512]: https://openjdk.org/jeps/512 diff --git a/docs/connect/java/postgresql-jdbc.md b/docs/connect/java/postgresql-jdbc.md index 93fb423b..d419c57c 100644 --- a/docs/connect/java/postgresql-jdbc.md +++ b/docs/connect/java/postgresql-jdbc.md @@ -135,7 +135,8 @@ of `wget`. Invoke-WebRequest https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar -OutFile postgresql-42.7.8.jar ``` ::: -Invoke program. Needs Java >= 21 ([JEP 445]), alternatively see [](#full-example). +Invoke program. This example needs Java >= 25 ([JEP 512]), +with earlier versions please use the [](#full-example). ```shell java -cp postgresql-42.7.8.jar example.java ``` @@ -146,4 +147,4 @@ java -cp postgresql-42.7.8.jar example.java ::: -[JEP 445]: https://openjdk.org/jeps/445 +[JEP 512]: https://openjdk.org/jeps/512 From 5d5de247f0bd195d0517310b41aa249d82286a4d Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 26 Oct 2025 00:40:57 +0200 Subject: [PATCH 12/17] Connect/Java: Reorganize "install" vs. "run" sections --- docs/connect/java/cratedb-jdbc.md | 37 ++++++++++++++-------------- docs/connect/java/postgresql-jdbc.md | 36 ++++++++++++++------------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/docs/connect/java/cratedb-jdbc.md b/docs/connect/java/cratedb-jdbc.md index 428147d5..49c93d81 100644 --- a/docs/connect/java/cratedb-jdbc.md +++ b/docs/connect/java/cratedb-jdbc.md @@ -95,6 +95,17 @@ Navigate to the CrateDB JDBC Driver installation page. Directly download the recommended `crate-jdbc-standalone-2.7.0.jar`. ::: +:::{card} Linux / macOS +```shell +wget https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar +``` +::: +:::{card} Windows +```powershell +Invoke-WebRequest https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar -OutFile crate-jdbc-standalone-2.7.0.jar +``` +::: + :::{rubric} Maven `pom.xml` ::: ```xml @@ -118,33 +129,23 @@ dependencies { } ``` -## Quickstart example +## Run + +:::{rubric} Quickstart example +::: -Create a file `example.java` including the synopsis code shared above. +Create the file `example.java` including the synopsis code shared above. :::{include} ../_cratedb.md ::: -Download JAR file. -```shell -wget https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar -``` -:::{dropdown} Instructions for Windows users -If you don't have the `wget` program installed, for example on Windows, just -download the JAR file using your web browser of choice. -If you want to use PowerShell, invoke the `Invoke-WebRequest` command instead -of `wget`. -```powershell -Invoke-WebRequest https://repo1.maven.org/maven2/io/crate/crate-jdbc-standalone/2.7.0/crate-jdbc-standalone-2.7.0.jar -OutFile crate-jdbc-standalone-2.7.0.jar -``` -::: Invoke program. This example needs Java >= 25 ([JEP 512]), -with earlier versions please use the [](#full-example). +with earlier versions please use the full example. ```shell java -cp crate-jdbc-standalone-2.7.0.jar example.java ``` - -## Full example +:::{rubric} Full example +::: :::{include} _jdbc_example.md ::: diff --git a/docs/connect/java/postgresql-jdbc.md b/docs/connect/java/postgresql-jdbc.md index d419c57c..d472c4c3 100644 --- a/docs/connect/java/postgresql-jdbc.md +++ b/docs/connect/java/postgresql-jdbc.md @@ -95,6 +95,17 @@ Navigate to the PostgreSQL JDBC Driver installation page. Directly download the recommended `postgresql-42.7.8.jar`. ::: +:::{card} Linux / macOS +```shell +wget https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar +``` +::: +:::{card} Windows +```powershell +Invoke-WebRequest https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar -OutFile postgresql-42.7.8.jar +``` +::: + :::{rubric} Maven `pom.xml` ::: ```xml @@ -116,32 +127,23 @@ dependencies { } ``` -## Quickstart example +## Run -Create a file `example.java` including the synopsis code shared above. +:::{rubric} Quickstart example +::: + +Create the file `example.java` including the synopsis code shared above. :::{include} ../_cratedb.md ::: -Download JAR file. -```shell -wget https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar -``` -:::{dropdown} Instructions for Windows users -If you don't have the `wget` program installed, for example on Windows, just -download the JAR file using your web browser of choice. -If you want to use PowerShell, invoke the `Invoke-WebRequest` command instead -of `wget`. -```powershell -Invoke-WebRequest https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.8/postgresql-42.7.8.jar -OutFile postgresql-42.7.8.jar -``` -::: Invoke program. This example needs Java >= 25 ([JEP 512]), -with earlier versions please use the [](#full-example). +with earlier versions please use the full example. ```shell java -cp postgresql-42.7.8.jar example.java ``` -## Full example +:::{rubric} Full example +::: :::{include} _jdbc_example.md ::: From 21addb85e442a6a989d5ea62efcea3d3fe643cdb Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 26 Oct 2025 01:04:37 +0200 Subject: [PATCH 13/17] Connect/Java: CI status badges for JDBC items --- docs/connect/java/testing.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/connect/java/testing.md b/docs/connect/java/testing.md index 12f98970..cecb3082 100644 --- a/docs/connect/java/testing.md +++ b/docs/connect/java/testing.md @@ -30,6 +30,7 @@ test execution, and stop CrateDB afterward. :Package: `io.crate:crate-testing` :Download: [io.crate:crate-testing] (Maven Central) :Repository: [crate-java-testing] +:CI status: [![Java: JDBC, QA](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml) :::: ::::{grid-item} :::{card} Using JUnit "crate-testing" with CrateDB @@ -56,6 +57,7 @@ which are using its {ref}`OCI container image `. :Download: [org.testcontainers:testcontainers-cratedb] (Maven Central) :Repository: [testcontainers-cratedb sources] :Documentation: [Testcontainers CrateDB Module] +:CI status: [![Testcontainers for Java](https://github.com/crate/cratedb-examples/actions/workflows/testing-testcontainers-java.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/testing-testcontainers-java.yml) :::: ::::{grid-item} :::{card} Using "Testcontainers for Java" with CrateDB From 0d903ee77b8ce8751f268565333e420bbbfe7b07 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 26 Oct 2025 01:05:05 +0200 Subject: [PATCH 14/17] Connect/Java: Relocate CI status badge on jOOQ page --- docs/connect/java/jooq.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/connect/java/jooq.md b/docs/connect/java/jooq.md index f60cfa79..85357aa2 100644 --- a/docs/connect/java/jooq.md +++ b/docs/connect/java/jooq.md @@ -5,6 +5,12 @@ :::{include} /_include/links.md ::: +```{div} .float-right .text-right +[![Java jOOQ](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-jooq.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-jooq.yml) +``` +```{div} .clearfix +``` + :::{div} [jOOQ] is an internal DSL and source code generator, modelling the SQL language as a type-safe Java API to help you write better SQL. @@ -35,6 +41,3 @@ Connect to CrateDB using jOOQ. +++ Java jOOQ demo application with CrateDB using PostgreSQL JDBC. ::: - - -[![Java jOOQ](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-jooq.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-jooq.yml) From ee9cb4516e5155bc8f0a15c8bc007a41cfc98eee Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 26 Oct 2025 01:05:44 +0200 Subject: [PATCH 15/17] Connect/Java: Show full package name, including version number --- docs/connect/java/testing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/connect/java/testing.md b/docs/connect/java/testing.md index cecb3082..13fde574 100644 --- a/docs/connect/java/testing.md +++ b/docs/connect/java/testing.md @@ -27,7 +27,7 @@ test execution, and stop CrateDB afterward. :::::{grid} ::::{grid-item} -:Package: `io.crate:crate-testing` +:Package: `io.crate:crate-testing:0.12.1` :Download: [io.crate:crate-testing] (Maven Central) :Repository: [crate-java-testing] :CI status: [![Java: JDBC, QA](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml) @@ -53,7 +53,7 @@ which are using its {ref}`OCI container image `. :::::{grid} ::::{grid-item} -:Package: `org.testcontainers:testcontainers-cratedb` +:Package: `org.testcontainers:testcontainers-cratedb:2.0.1` :Download: [org.testcontainers:testcontainers-cratedb] (Maven Central) :Repository: [testcontainers-cratedb sources] :Documentation: [Testcontainers CrateDB Module] From 38207f29e92b6052b4e5d25e39c888ab9bb7298f Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 26 Oct 2025 16:59:05 +0100 Subject: [PATCH 16/17] Connect/Java: Add references to Apache Flink and Apache Spark --- docs/_include/logos.md | 4 ++++ docs/connect/java/index.md | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/docs/_include/logos.md b/docs/_include/logos.md index 2b1d6ad7..de6647b0 100644 --- a/docs/_include/logos.md +++ b/docs/_include/logos.md @@ -3,11 +3,15 @@ [CrateDB home]: https://cratedb.com/ [CrateDB logo]: https://avatars.githubusercontent.com/u/4048232?s=200&v=4 +[Flink home]: https://flink.apache.org/ +[Flink logo]: https://flink.apache.org/img/logo/png/50/color_50.png [Hibernate logo]: https://logo.svgcdn.com/devicon/hibernate-original.svg [jOOQ logo]: https://www.jooq.org/img/jooq-logo-black.png [JUnit home]: https://junit.org/ [JUnit logo]: https://avatars.githubusercontent.com/u/874086?s=200&v=4 [PostgreSQL home]: https://www.postgresql.org/ [PostgreSQL logo]: https://jdbc.postgresql.org/icons/postgreslogo.svg +[Spark logo]: https://www.vectorlogo.zone/logos/apache_spark/apache_spark-icon.svg +[Spark home]: https://spark.apache.org/ [Testcontainers for Java]: https://testcontainers.com/guides/getting-started-with-testcontainers-for-java/ [Testcontainers logo]: https://avatars.githubusercontent.com/u/13393021?s=200&v=4 diff --git a/docs/connect/java/index.md b/docs/connect/java/index.md index c589130a..c31aa2db 100644 --- a/docs/connect/java/index.md +++ b/docs/connect/java/index.md @@ -32,6 +32,9 @@ 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 {ref}`CrateDB JDBC internals ` page includes more information about compatibility and differences between the two driver variants, and more details about the CrateDB JDBC Driver. @@ -80,6 +83,28 @@ JUnit support and Testcontainers for CrateDB. ::::: +:::{rubric} Frameworks +::: + +:::::{grid} 2 2 2 3 +:gutter: 2 +:padding: 0 + +::::{grid-item-card} ![Flink logo][Flink logo]{height=40px}   Apache Flink +:link: flink +:link-type: ref +:link-alt: Apache Flink and CrateDB +Use CrateDB with Apache Flink. +:::: + +::::{grid-item-card} ![Spark logo][Spark logo]{height=40px}   Apache Spark +:link: spark +:link-type: ref +:link-alt: Apache Spark and CrateDB +Use CrateDB with Apache Spark. +:::: + +::::: :::{toctree} From 07211596c9496e0340445f4726c81710bf1c5630 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 26 Oct 2025 17:55:22 +0100 Subject: [PATCH 17/17] Connect/Java: Add CI status badges instead of logos --- docs/connect/java/cratedb-jdbc.md | 2 +- docs/connect/java/postgresql-jdbc.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/connect/java/cratedb-jdbc.md b/docs/connect/java/cratedb-jdbc.md index 49c93d81..f91f9fec 100644 --- a/docs/connect/java/cratedb-jdbc.md +++ b/docs/connect/java/cratedb-jdbc.md @@ -7,7 +7,7 @@ # CrateDB JDBC ```{div} .float-right -[![CrateDB logo][CrateDB logo]{height=40px loading=lazy}][CrateDB home] +[![Java: JDBC, QA](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml) ``` ```{div} .clearfix ``` diff --git a/docs/connect/java/postgresql-jdbc.md b/docs/connect/java/postgresql-jdbc.md index d472c4c3..abbe5ae4 100644 --- a/docs/connect/java/postgresql-jdbc.md +++ b/docs/connect/java/postgresql-jdbc.md @@ -7,7 +7,7 @@ # PostgreSQL JDBC ```{div} .float-right -[![PostgreSQL logo][PostgreSQL logo]{height=40px loading=lazy}][PostgreSQL home] +[![Java: JDBC, QA](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml) ``` ```{div} .clearfix ```