Breaking Changes
-
[jdbc-v2] The driver no longer hardcodes the server settings
async_insert=0andwait_end_of_query=0on every JDBC
connection. This unblocks two scenarios that previously did not work: overriding these settings per connection or per
statement, and using the driver against read-only profiles that disallowSETTINGSoverrides. There are two consequences:- The driver now follows the server-side defaults for these settings (note: starting with ClickHouse 26.3,
async_insert
defaults to1). Removing the explicitwait_end_of_query=0is a no-op against server defaults but lets users opt in to
wait_end_of_query=1. - The row count returned by
java.sql.Statement.executeUpdate(java.lang.String)(and the matchingPreparedStatement
method) is no longer guaranteed to be accurate for INSERT statements when the server runs them asynchronously, and
parsing/data errors in the INSERT body may not surface synchronously as aSQLException. Previously these were
accurate because inserts were forced to be synchronous (see also ClickHouse/ClickHouse#57768).
To restore the previous behavior, setasync_insert=0(orwait_for_async_insert=1) per connection as server setting.
Read more about asynchronous insert: https://clickhouse.com/docs/optimize/asynchronous-inserts.
- The driver now follows the server-side defaults for these settings (note: starting with ClickHouse 26.3,
-
[client-v2]
Client.Builder#build()now throwsClientMisconfigurationExceptioninstead of
IllegalArgumentExceptionfor authentication and SSL misconfiguration (missing credentials, conflicting
authentication methods, missing client certificate when SSL authentication is enabled, and trust store used together
with a client certificate). Callers that relied on catchingIllegalArgumentExceptionfrombuild()for these cases
must catchClientMisconfigurationException(which extendsRuntimeExceptionviaClientException). (#2812) -
[client-v2] Combining
setUsername(...)+setPassword(...)with a customAuthorizationHTTP header (
httpHeader(HttpHeaders.AUTHORIZATION, ...)) now fails atClient.Builder#build()with
ClientMisconfigurationExceptionunless HTTP Basic authentication is explicitly disabled via
useHTTPBasicAuth(false). Previously this combination was accepted and the customAuthorizationheader overrode
the user/password at request time. (#2812) -
[client-v2] The
access_tokenconfiguration property (set viaClient.Builder#setAccessToken(String)or directly
throughsetOption) is now actually applied to outgoing requests as theAuthorizationHTTP header value verbatim.
Previously the value was stored underaccess_tokenbut never sent on the wire, so providing it alone had no effect
on authentication. Callers must include the scheme prefix themselves (e.g.setAccessToken("Bearer <token>")), or use
useBearerTokenAuth(String)which prependsBearerautomatically. (#2812) -
[client-v2]
Client.Builder#useBearerTokenAuth(String)now stores the bearer token under theaccess_token
configuration key (with theBearerprefix) instead of writing it directly intohttp_header_authorization. The
HTTP wire format is unchanged, but the token is no longer observable throughClient#getReadOnlyConfig()under the
http_header_authorizationkey. (#2812) -
[client-v2] Fixed inconsistent use of
executionTimeoutparameter inClientcomponent. The timeout was
previously set in milliseconds but mistakenly retrieved and used in seconds in some places. Now it correctly uses
milliseconds consistently. (#2358) -
[client-v2] The public
ClickHouseBinaryFormatWriterinterface gained two methods,setString(String, byte[])andsetString(int, byte[]), for writing rawString/FixedStringbytes. Code that only uses the interface is unaffected, but any third party that implementsClickHouseBinaryFormatWriterdirectly is source- and binary-incompatible until it adds these methods (recompiling against the new version is required; otherwise anAbstractMethodErrorcan occur at runtime). -
[client-v2] HTTP
503 Service Unavailableresponses are now surfaced as a connection-style failure (
java.net.ConnectException) and are retried by default. Previously a503was treated as a server error (
ServerException) and fell under theServerRetryablefault cause. It has been moved to theConnectTimeoutfault
cause category so that connectivity/availability failures are handled uniformly with other connection errors. Callers
that specifically excludedServerRetryableto avoid retrying503should now adjust their
client_retry_on_failuresconfiguration to excludeConnectTimeoutinstead. -
[client-v2] Unexpected/unknown HTTP status codes (those the client cannot interpret as a ClickHouse response) now
throw aClientExceptioninstead of aServerException. Since the client cannot meaningfully handle these responses,
they are reported as a client-side error rather than being attributed to the server.
New Features
-
[jdbc-v2, client-v2] Implemented SSL modes configuration. Now it is possible to set
ssl_modetoDISABLED,
TRUST,VERIFY_CAandSTRICT. Note for V1 users:NONEis supported only by JDBC driver and mapped toTRUST.
Please migrate to the new naming.- Examples for client-v2 https://github.com/ClickHouse/clickhouse-java/blob/main/examples/client-v2/src/main/java/com/clickhouse/examples/client_v2/SSLExamples.java
- Examples for jdbc-v2 https://github.com/ClickHouse/clickhouse-java/blob/main/examples/jdbc/src/main/java/com/clickhouse/examples/jdbc/SSLExamples.java
(#2874, #2389,
#2309, #2819)
-
[jdbc-v2, client-v2] (beta) Implemented standalone readers for
JSONEachRowto provide scaffold for
reading this format. Additionally, it gives a way to mapJsoncolumns to custom types using JDBC driver. See examples
in https://github.com/ClickHouse/clickhouse-java/tree/main/examples/jdbc-v2-json-processors and https://github.com/ClickHouse/clickhouse-java/tree/main/examples/client-v2-json-processors.
(#2871) -
[client-v2] Added
SessionAPI to encapsulate and manage ClickHouse session settings (session_id,
session_check,session_timeout,session_timezone) as a reusable object. TheSessioninstance can be applied to
any request settings usingapplyTo(), and session state can be cleared viaclearSession(). Additionally, added
resetOption(String)toInsertSettings,QuerySettings, andCommonSettingsto allow removing specific settings.
Settings explicitly set tonullwill not be sent to the server, which is useful for overriding global settings.
(#2810) -
[client-v2] Added runtime credential update APIs on
Client:updateUserAndPassword(String, String),
updateAccessToken(String), andupdateBearerToken(String). Subsequent requests on the sameClientinstance use
the new credentials without rebuilding the client. The authentication method is fixed at construction time; calling a
runtime updater that does not match the configured method throwsClientMisconfigurationException. See
docs/authentication.mdfor details and migration guidance. (#2812) -
[jdbc-v2] Added
cluster_nameconfiguration property to specify a target cluster for statements likeKILL QUERY
that require anON CLUSTERclause to execute across all
nodes. (#2837) -
[client-v2, jdbc-v2] Added support for ClickHouse
Geometrytype for ClickHouse25.11+, whereGeometry
changed from aStringalias toVariant(Point, Ring, LineString, MultiLineString, Polygon, MultiPolygon)(client
still compatible with older versions). Includes client read/write handling and JDBC type mapping for retrieving and
inserting geometry values. Current writes infer the target geometry variant from array nesting depth, soRingvs
LineStringandPolygonvsMultiLineStringare not yet distinguishable through the genericGeometrywrite
path. (#2815) -
[jdbc-v2]
ResultSet#getObject(int|String, Map<String, Class<?>>)now accepts ClickHouse type names as map keys
in addition to the JDBCSQLTypenames it has always accepted. Only unwrapped type names are used for the lookup —
Nullable(...)andLowCardinality(...)wrappers are stripped and do not affect resolution, so a key like"Int32"
matches bothInt32andNullable(Int32)columns; keys like"Nullable(Int32)"are not recognized. Lookup order is
theClickHouseDataTypeenum name (e.g."Int32","String","DateTime") then the JDBCSQLTypename (e.g.
"INTEGER","VARCHAR","TIMESTAMP"); a missing entry leaves the value uncoerced. The feature is supported for
primitive ClickHouse types only —Array,Tuple,Map,Nested, and geometry types are not supported and continue
to be returned in their native form regardless of the user-supplied map. Existing maps keyed only by JDBCSQLType
names continue to work unchanged. (#2865) -
[jdbc-v2] Added support of custom mapping for JDBC types. Mainly used in cases when big integers should be
presented as string. UseDriverProperties.JDBC_TYPE_MAPPINGS(jdbc_type_mappings) and set needed type mapping
askey=value[,]list (For example,Int32=Long,UInt64=String). Deprecation notice: V1 propertytypeMappingsis
supported but will be removed. Please migrate to the new property.
(#2858) -
[client-v2, jdbc-v2] Added opt-in binary string support through the
binary_string_supportconfiguration property
(orClient.Builder#binaryStringSupport(boolean)), disabled by default. The setting is resolved per operation from
the merged client and query settings, so it can be overridden for a single request via thebinary_string_support
operation option (e.g.QuerySettings#setOption(ClientConfigProperties.BINARY_STRING_SUPPORT.getKey(), true))
independently of the client-level default. When enabled, top-levelStringandFixedStringcolumns are read
into aStringValuethat preserves the raw bytes instead of decoding them into aString, allowing non-UTF-8/binary
content to round-trip byte-for-byte.StringValueexposes the bytes viatoByteArray()/asByteBuffer()and
lazily decodes aStringviaasString()(UTF-8 by default, or a caller-suppliedCharset). Values nested inside
containers (Array,Map,Tuple,Nested,Variant) continue to be read asString, since those types are not
expected to carry large/binary strings. On the JDBC side,ResultSet#getBinaryStream(int)and
ResultSet#getBinaryStream(String)are now implemented (previously unsupported) and, together withgetBytes(...),
return the raw column bytes. -
[client-v2] Added
Client#cancelTransportRequest(String queryId)to cancel an in-flight request that has not yet
received a response from the server, identified by the query id supplied in the operation settings. This aborts the
request on the client side (cancels the underlying IO operation) but does not issue aKILL QUERYon the server,
so a query that already started executing may continue to run server-side. It is recommended to use operation timeout
settings where possible; this API is intended for explicitly aborting a request from the client.
Improvements
- [jdbc-v2, client-v2] Added support of hostnames with underscore (
_) in them. Now it is possible to specify endpoint
likech_db_01. This is mostly used in k8s environment. (#2792,
#2753)
Updated Dependencies
- [tests] Bump org.postgresql:postgresql from 42.6.1 to 42.7.11
Docs & Examples
-
[client-v2] Added example of working with
Apache Arrowlibrary using client. (#2820) -
[repo] Added a contribution guide. Please review and send us your feedback. (#2859)
Bug Fixes
-
[jdbc-v2, client-v2] Fixed error handling for responses that not a ClickHouse error, like
404response. (#2803) -
[jdbc-v2, client-v2] Fixed setting
nullas password. Previously it was converted tonullliteral. Still we recommend
passing empty string. (#2809) -
[jdbc-v2, client-v2] Fixed
ClickHouseBinaryFormatReader::getBigDecimalsilently truncating big integer.
(#2748) -
[jdbc-v2, client-v2] Fixed handling
NULLvalues toVariantandDynamiccolumns. Previously indicator
ofNULLwas not set and read. (#2789, #2791) -
[jdbc-v2] Fixed
Statement.cancel()throwingSESSION_IS_LOCKEDwhen the statement was running inside a
ClickHouse session. The driver now acceptssession_id,session_check, andsession_timeoutas first-class
connection properties and correctly suppresses them when issuing aKILL QUERYduring cancellation. This ensures the
cancellation request runs outside the session and no longer contends with the running query for the session
lock. (#2690, #2881) -
[jdbc-v2] Added option to specify cluster name for operations on cluster. One of them is
KILL QUERY .. ON CLUSTER <cluster_name>.
UseDriverProperties.CLUSTER_NAME(jdbc_cluster_name) to define name of the cluster to be used in such queries.
(#2837) -
[jdbc-v2, client-v2] Fixed writing nullable marker for nested
Tupleand `Map values. (#2721) -
[jdbc-v2] Fixed
ResultSet.getObjectleaking the internalStringValueholder forString/FixedString
columns whenbinary_string_supportis enabled.getObject(column, byte[].class)now returns the exact raw bytes,
andgetObject(column, Object.class)and the no-typegetObject(column)overloads now return a decodedString
instead of the internal holder.