Requirements and behavior by workgroup engine
JDBC 4.x supports workgroups that use Athena engine version 3 or DuckDB. The driver reads the workgroup engine and result storage when it configures a connection. The following comparisons describe behavior within the 4.x driver.
For changes from the previous driver generation, see Migrate from JDBC 3.x. For installation instructions, see Get started with the JDBC 4.x driver.
Check requirements before connecting
Allow athena:GetWorkGroup for the credentials used by the driver. This lookup is also used when you supply EngineVersion. An engine override does not remove the workgroup lookup.
For engine version 3 streaming, follow the legacy streaming policy requirements. The DuckDB Arrow fetcher calls GetQueryResultStream using the connection credentials. For DuckDB data access requirements, see IAM permissions.
| Requirement | Engine version 3 | DuckDB |
|---|---|---|
| Workgroup lookup | athena:GetWorkGroup | athena:GetWorkGroup |
| EngineVersion value | Athena engine version 3 | DuckDB |
| Streaming authorization | Legacy streaming policy requirements | The driver calls GetQueryResultStream with the connection credentials. |
| Stream endpoint | The legacy stream uses port 444 by default. | The Arrow stream uses the Athena API endpoint configuration. |
| Arrow JVM configuration | The legacy stream does not use the Arrow fetcher. | --add-opens=java.base/java.nio=ALL-UNNAMED for the Arrow fetcher |
Leave EngineVersion unset to select the engine reported by the workgroup. An unrecognized engine is a connection error unless a supported override is supplied.
Choose result fetching for your workgroup
Result storage affects the fetcher selected by ResultFetcher=auto. Managed query results and results in a customer-owned Amazon S3 bucket use different routes.
| Result storage | Engine version 3: auto | DuckDB: auto |
|---|---|---|
| Managed query results | GetQueryResultsStream | GetQueryResultStream with Apache Arrow; falls back to GetQueryResults if the Arrow runtime probe fails. |
| Customer-owned Amazon S3 bucket | S3; falls back to GetQueryResultsStream for CSE_KMS encryption or an S3 AccessDenied error while opening the results. | S3; falls back to GetQueryResults for CSE_KMS encryption or an S3 AccessDenied error while opening the results. |
Use the following table when you explicitly set ResultFetcher. Combinations marked "Not available" are rejected during connection setup.
| Explicit ResultFetcher | Engine version 3 | DuckDB: managed results | DuckDB: customer bucket |
|---|---|---|---|
GetQueryResults | Accepted | Accepted | Accepted |
GetQueryResultsStream | Accepted | Not available | Not available |
GetQueryResultStream | Not available | Accepted when Arrow is available on the JVM | Not available |
S3 | Accepted; see the restrictions below. | Not available | Accepted |
S3V2 | Accepted; see the restrictions below. | Not available | Not available |
On engine version 3, S3 and S3V2 are accepted during parameter validation, but cannot read Athena-managed results or CSE_KMS-encrypted results. Use auto to select the result fetcher for these cases.
With ResultFetcher=auto, a DuckDB connection with managed results falls back to GetQueryResults when the Arrow runtime probe fails. An explicit ResultFetcher=GetQueryResultStream instead fails validation. Add --add-opens=java.base/java.nio=ALL-UNNAMED to the JVM command line to enable Arrow, or select GetQueryResults.
Review SQL and result metadata
The driver selects the SQL escape processor, parameter literal renderer, and result type system for the connection engine. Use the SQL syntax and result types for that engine.
| Behavior | Engine version 3 | DuckDB |
|---|---|---|
| Identifier quote reported by the driver | " | " |
| Bound time literal | TIME '13:30:00' | TIME '13:30:00' |
| JSON result metadata | Types.VARCHAR; Java String | Types.OTHER; Java String |
| Plain timestamp result metadata | Types.TIMESTAMP; Java Timestamp | Types.TIMESTAMP; Java Timestamp |
| Timestamp with time zone result metadata | Types.TIMESTAMP_WITH_TIMEZONE | Types.TIMESTAMP_WITH_TIMEZONE |
For JDBC prepared statements, the driver renders bound values with the selected engine dialect and sends them as execution parameters with StartQueryExecution.
For DuckDB mappings and conversions, see Data types and result conversion. For connection failures, see Troubleshoot JDBC 4.x.