You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[jdbc-v2] [output format] SQL Error [HY000]: Only RowBinaryWithNameAndTypes is supported for output format. Please check your query. #2715
data-typesArea: type names, value encoding and decoding, row mapping, data formatsdocumentationImprovements or additions to documentationenhancementjdbcModule: the JDBC driver (jdbc-v2; with legacy: the v1 driver)
Migrating from clickhouse jdbc driver 0.6.5 to clickhouse jdbc v2 driver 0.9.6, some queries stopped working.
Steps to reproduce
SELECT 1 as x FORMAT JSON
Error Log or Exception StackTrace
Exception in thread "main" java.sql.SQLException: Only RowBinaryWithNameAndTypes is supported for output format. Please check your query.
at com.clickhouse.jdbc.StatementImpl.executeQueryImpl(StatementImpl.java:164)
at com.clickhouse.jdbc.PreparedStatementImpl.executeQuery(PreparedStatementImpl.java:144)
at ClickHouseTest.main(ClickHouseTest.java:18)
Clickhouse server does not produce any error, and 'clickhouse client' executes the above query without issues, therefore, I assume, there is some issue at the jdbc client side.
We have not ported this "feature" because wanted to make V2 following standard. In this particular case we also need to support JSON format because it is not just JSON but data + metadata. Metadata should be parsed into ResultSetMetadata to keep JDBC driver usable.
In 0.10.0-rc1 we have added support for JSONEachRow in the way you can plugin your favorite JSON library and get already parsed data. https://github.com/ClickHouse/clickhouse-java/tree/main/examples/jdbc-v2-json-processors
Would it work in your case?
This code will work only with ClickHouse driver. Would it more convenient if we add a shortcut method to make request with internal client?
Sorry for breaking the compatibility but we have to handle many use-cases.
@chernser , thanks for providing your feedback for this issue.
I've checked again the use case I had in mind and, to be honest, cannot recall the exact details.
The production code is relying on JSONEachRow since 2025, while I opened the ticket in 2026.
Therefore, I think, I reported this ticket because of another use case - querying data via DBeaver.
Imagine, I have clickhouse client and DBeaver client. In both I wanted to execute the same query with FORMAT JSON output.
but it worked fine in clickhouse client and stopped working in DBeaver (relying on JDBC drivers). I guess, that was the case.
Also, I can recall explain plain <sql> in DBeaver failed with exact same exception. Maybe this also triggered me to report this ticket. I just don't remember how far I went in root cause analysis 😄.
Having said that - I certainly can fix my code (it's already fixed), but cannot make something get to work in DBeaver that used to work there, and hard to explain why it continues working in clickhouse client and not in DBeaver.
There also will be nice to have a support for FORMAT Null for query speed evaluation, since it just executes query and not returns any data to client. It was supported back in 0.6.3. And now we can not use it in Datagrip/DBeaver
Recommendation: Keep open — maintainer decision
Decide whether jdbc-v2 gives FORMAT JSON output through a ResultSet. The getClient() workaround that #2927 documented also needs a docs change for ClickHouse 26.8+ (Analysis).
Status on main: Not supported on main — on ClickHouse 26.3 the issue's code throws the reported SQLException; on 26.11 it returns column x = 1 with no error.
Breaking change: No — can be done without a break, behind a new option.
Workaround:getClient().query("SELECT 1 AS x", new QuerySettings().setFormat(ClickHouseFormat.JSON)) returns the JSON document on both servers.
Analysis: jdbc-v2 reads only RowBinaryWithNamesAndTypes and parsed JSONEachRow, and rejects other formats (jdbc-v2/src/main/java/com/clickhouse/jdbc/StatementImpl.java:329); docs/features.md:123 documents that FORMAT JSON is not a ResultSet. On ClickHouse 26.8+ the default format header of the driver replaces the FORMAT clause (docs/integration-jdbc.md:501), so the clause has no effect. Docs change: the getClient().query("SELECT 1 AS x FORMAT JSON") example (docs/client-v2-json-support.md:374, docs/features.md:123) gets RowBinaryWithNamesAndTypes bytes on 26.8+, not JSON. EXPLAIN PLAN, which the reporter also recalls, works on both servers.
Reproduction: complete program and output
Changed from the issue's steps: the URL and password come from the environment, each case catches its exception, and the EXPLAIN PLAN and getClient() cases are added.
SELECT 1 as x FORMAT JSON -> column x: 1 |
EXPLAIN PLAN SELECT 1 -> column explain: Output: 1 | | ReadFromSystemOne |
getClient() + FORMAT JSON -> format RowBinaryWithNamesAndTypes: ..x.UInt8.
getClient() + setFormat(JSON) -> format JSON: { "meta": [ { "name": "x", "ty
Output on main (8480ca001), ClickHouse 26.3.66.4:
SELECT 1 as x FORMAT JSON -> java.sql.SQLException: Only RowBinaryWithNameAndTypes and JSONEachRow are supported for output format, but received format 'JSON'. Please check your query or 'format' property configuration.
EXPLAIN PLAN SELECT 1 -> column explain: Expression ((Project names + (Projection + Change column names to column identifiers))) | ReadFromSystemOne |
getClient() + FORMAT JSON -> format JSON: { "meta": [ { "name": "x", "ty
getClient() + setFormat(JSON) -> format JSON: { "meta": [ { "name": "x", "ty
Automated triage by Polyglot AI. A maintainer makes the final decision.
data-typesArea: type names, value encoding and decoding, row mapping, data formatsdocumentationImprovements or additions to documentationenhancementjdbcModule: the JDBC driver (jdbc-v2; with legacy: the v1 driver)
Activity
chernser commentedon Jul 16, 2026
@ikfid
Thank you for reporting the issue!
We have not ported this "feature" because wanted to make V2 following standard. In this particular case we also need to support JSON format because it is not just JSON but data + metadata. Metadata should be parsed into ResultSetMetadata to keep JDBC driver usable.
In
0.10.0-rc1we have added support forJSONEachRowin the way you can plugin your favorite JSON library and get already parsed data. https://github.com/ClickHouse/clickhouse-java/tree/main/examples/jdbc-v2-json-processorsWould it work in your case?
This code will work only with ClickHouse driver. Would it more convenient if we add a shortcut method to make request with internal client?
Sorry for breaking the compatibility but we have to handle many use-cases.
Thanks!
ikfid commentedon Jul 17, 2026
@chernser , thanks for providing your feedback for this issue.
I've checked again the use case I had in mind and, to be honest, cannot recall the exact details.
The production code is relying on JSONEachRow since 2025, while I opened the ticket in 2026.
Therefore, I think, I reported this ticket because of another use case - querying data via DBeaver.
Imagine, I have
clickhouse clientandDBeaverclient. In both I wanted to execute the same query withFORMAT JSONoutput.but it worked fine in
clickhouse clientand stopped working inDBeaver(relying on JDBC drivers). I guess, that was the case.Also, I can recall
explain plain <sql>in DBeaver failed with exact same exception. Maybe this also triggered me to report this ticket. I just don't remember how far I went in root cause analysis 😄.Having said that - I certainly can fix my code (it's already fixed), but cannot make something get to work in DBeaver that used to work there, and hard to explain why it continues working in clickhouse client and not in DBeaver.
telperions commentedon Jul 17, 2026
There also will be nice to have a support for
FORMAT Nullfor query speed evaluation, since it just executes query and not returns any data to client. It was supported back in 0.6.3. And now we can not use it in Datagrip/DBeaverdocs(jdbc-v2): document raw FORMAT JSON access via client
chernser commentedon Jul 28, 2026
@telperions added as another issue #2963
@ikfid I will see what we can do here.
polyglotAI-bot commentedon Nov 28, 2026
Recommendation: Keep open — maintainer decision
Decide whether jdbc-v2 gives
FORMAT JSONoutput through aResultSet. ThegetClient()workaround that #2927 documented also needs a docs change for ClickHouse 26.8+ (Analysis).main: Not supported on main — on ClickHouse 26.3 the issue's code throws the reportedSQLException; on 26.11 it returns columnx=1with no error.JSONEachRowas text): one decision covers both.getClient().query("SELECT 1 AS x", new QuerySettings().setFormat(ClickHouseFormat.JSON))returns the JSON document on both servers.Analysis: jdbc-v2 reads only
RowBinaryWithNamesAndTypesand parsedJSONEachRow, and rejects other formats (jdbc-v2/src/main/java/com/clickhouse/jdbc/StatementImpl.java:329);docs/features.md:123documents thatFORMAT JSONis not aResultSet. On ClickHouse 26.8+ the default format header of the driver replaces theFORMATclause (docs/integration-jdbc.md:501), so the clause has no effect. Docs change: thegetClient().query("SELECT 1 AS x FORMAT JSON")example (docs/client-v2-json-support.md:374,docs/features.md:123) getsRowBinaryWithNamesAndTypesbytes on 26.8+, not JSON.EXPLAIN PLAN, which the reporter also recalls, works on both servers.Reproduction: complete program and output
Changed from the issue's steps: the URL and password come from the environment, each case catches its exception, and the
EXPLAIN PLANandgetClient()cases are added.Output on
main(8480ca001), ClickHouse 26.11.2.4:Output on
main(8480ca001), ClickHouse 26.3.66.4:Automated triage by Polyglot AI. A maintainer makes the final decision.