title: 'Java SDK' description: 'Connect to Spice using the Java SDK' pagination_prev: null pagination_next: null tags:
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Create a SpiceClient using default configuration.
Requires local Spice OSS running: follow the quickstart
Or pass custom flight address:
The SpiceClient implements connection retry mechanism (3 attempts by default).
The number of attempts can be configured with withMaxRetries:
Retries are performed for connection and system internal errors. It is the SDK user's responsibility to properly handle other errors, for example RESOURCE_EXHAUSTED (HTTP 429).
The SDK supports parameterized queries using ADBC (v0.5.0+). Use queryWithParams() for queries with user input to prevent SQL injection:
For explicit type control, use the Param class:
For more details, see Parameterized Queries.
The SpiceClient uses an Arrow RootAllocator for managing off-heap memory. By default, it uses all available memory. You can configure the memory limit using megabytes:
Use refresh method to perform Accelerated Dataset refresh. See full dataset refresh example.