JDBC (opens in a new tab) (Java Database Connectivity) is a standard API for connecting to and interacting with databases.
Spice supports JDBC clients through a JDBC driver implementation based on the Flight SQL (opens in a new tab) protocol. This enables any JDBC-compatible application to connect to Spice, execute queries, and retrieve data.
flight-sql-jdbc-driver-XX.XX.XX.jar file (with only the .jar file extension) from the list of files to download the driver jar fileFollow the instructions specific to your application for adding a custom JDBC driver. Examples:
Tableau:
C:\Program Files\Tableau\Drivers~/Library/Tableau/Drivers/opt/tableau/tableau_driver/jdbcFull instruction (opens in a new tab)
JetBrains DataGrip:
.jar fileFull instruction (opens in a new tab)
DBeaver:
.jar file.Full instruction (opens in a new tab)
jdbc:arrow-flight-sql://{host}:{port}PostgreSQLFor example:
:::info
Spice has TLS support (opens in a new tab). For testing or non-production use cases for Spice without TLS, the following JDBC connection URL will bypass TLS jdbc:arrow-flight-sql://{host}:{port}?useEncryption=false&disableCertificateVerification=true.
:::
If API Key authentication (opens in a new tab) is enabled, the API key can be provided in the JDBC connection URL as a query parameter:
jdbc:arrow-flight-sql://{host}:{port}?user=&password=<enter-api-key-here>
Replace <enter-api-key-here> with the API key value. The user and password parameters are required by the JDBC driver, but only the password parameter is used for the API key.
In the configured application, run a sample query, such as SELECT * FROM taxi_trips;
Spice supports parameterized queries with JDBC. Parameterized queries help prevent SQL injection and improve code clarity by separating query logic from data values.