Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 1.25 KB

File metadata and controls

64 lines (45 loc) · 1.25 KB

Java JDBC Client with Parameterized Queries

Works with v1.0+

This guide demonstrates how to use Java to query Spice via the Apache Arrow Flight SQL JDBC driver. The example connects to a local Spice OSS runtime, executes a parameterized query, and fetches results.

Requirements

  • Java 11 or newer
  • Maven installed
  • Spice CLI installed and Spice OSS runtime available

Steps

1. Clone this repository

git clone https://github.com/spiceai/cookbook.git
cd cookbook/clients/java

2. Build the project

mvn clean compile

3. Start Spice OSS

In a separate terminal, start the Spice OSS runtime:

spice run

4. Run the Java client

MAVEN_OPTS="--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED" \
mvn exec:java \
  -Dexec.mainClass="MessagingServiceApp"

Expected output:

Add-ons by account and service:
addon1
addon2
addon6

Add-ons by add-on type:
addon1
addon2
addon4
addon6
addon8
addon10

Learn more