JDBC (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 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/jdbcJetBrains DataGrip:
.jar fileDBeaver:
.jar file.jdbc:arrow-flight-sql://{host}:{port}PostgreSQLFor example:
:::info
Spice has TLS support. 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 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.