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

useServerTimeZone == true doesn't work

Open Dustangelms opened this issue 3 years ago • 2 comments

https://github.com/ClickHouse/clickhouse-jdbc/blob/c98c084e35ee68249274fcd273644545d90e82a3/clickhouse-jdbc/src/main/java/com/clickhouse/jdbc/internal/ClickHouseConnectionImpl.java#L279-L282

The GregorianCalendar object is created using local default time zone, not server time zone.

Dustangelms avatar Jun 17 '22 15:06 Dustangelms

Thanks @Dustangelms for pointing this out. It does not look correct but Calendar was used in a way to get consistent result from mysql interface. If you need to deal with timezone, it is recommended to use LocalDate/LocalDateTime/OffsetDateTime instead of legacy Date/Calendar API, also please be aware that the latter is 10 times slower.

zhicwu avatar Jun 19 '22 04:06 zhicwu

, it is recommended to use LocalDate/LocalDateTime/OffsetDateTime instead of legacy Date/Calendar API, also please be aware that the latter is 10 times slower

We can't because ClickHouse driver uses the type Date and GregorianCalendar internal

TheHett avatar Feb 28 '24 06:02 TheHett