clickhouse-java icon indicating copy to clipboard operation
clickhouse-java copied to clipboard

Change of format during retrieval of DateTime and Int16 using jdbc-V2

Open emili4ciccone opened this issue 6 months ago • 0 comments

Description

I have encountered different problems retrieving data with new jdbc-v2 client. In particular, I encountered some issues when updating clickhouse-jdbc from release 0.7.2 (which still used jdbc-v1) to release 0.8.5 (which, if I get it right, uses by default jdbc-v2). More specifically, my issues are with:

  1. Retrieve of DateTime objects: with release 0.7.2, by doing a SELECT * from a table with a DateTime column, when trying to map the retrieved DateTime to a String, I get a String like "2025-05-30 12:36:22"; when I update clickhouse-jdbc to 0.8.5 release, I get a ZonedDateTime to String object, like "2025-05-30T12:36:22Z[Etc/UTC]"
  2. Retrieve of Int16 objects and map them into Short; similarly, I try to retrieve some Int16 values and map them into Short: in 0.7.2, I used ((Short) map.get("int64_column")).shortValue(), while with 0.8.5 release I have to do ((Integer) map.get("int64_column")).shortValue()

I tried to use property clickhouse.jdbc.v1=true and, with the DateTime columns problem, I tried with properties: properties.setProperty("date_time_output_format", "iso"), properties.setProperty("date_time_output_format", "simple") and properties.setProperty("server_time_zone", "UTC") but nothing changed.

Steps to reproduce

  1. Update clickhouse-jdbc to 0.8.x
  2. Try to query on a table with a DateTime column and map the values into a String 2.1. Try to query on a table with a Int16 column and map the values into a Short

emili4ciccone avatar Jun 03 '25 09:06 emili4ciccone