-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Localdatetime always uses the server time zone #888
Comments
Hi @779833371, is there any specific reason of using legacy driver? If not, I'd strongly suggest you to upgrade to 0.3.2, which is a complete rewrite with improved timezone support. In addition, it is recommended to use LocalDateTime/OffsetDateTime etc instead of java.sql.Timestamp. |
my java entity is used LocalDateTime not Timestamp, I upgrade to upgrade to 0.3.2 ,but useless |
I am sorry ,i only switch the driver-class-name but not upgeade pom.xml, i use group id com.clickhouse an upgeade to 0.3.2,and the problem are resloved,thanks! |
Good to know. The latest version is 0.3.2-patch7, and patch8 will be released soon. In case anyone else ran into similar issue, please refer to examples above and #623. |
clickhouse-jdbc version 0.3.1
clickhouse fieldtype : Nullable(DateTime)
clickhouse timezone:Asia/Shanghai
the java entity type is LocalDateTime
now ,i hava a record from clickhouse and the value is field start_time 2022-03-31 19:31:15, I use mybatis-pius to query the data.
but the java entity result is 2022-03-31 11:31:15,I track the code and found the value is changed in ru.yandex.clickhouse.response.parser.ClickHouseDateValueParser.dateTimeToLocalDateTime()
and then return 2022-03-31 11:31:15.
I found the columnInfo.getTimeZone() is afferent by ru.yandex.clickhouse.response.ClickHouseResultSet.
in ClickHOuseResultSet.java ,TimeZone is from ((ClickHouseConnection)statement.getConnection()).getServerTimeZone();
I found the serverTimeZone field init in ru.yandex.clickhouse.ClickHouseConnectionImpl. initConnection
so ,the serverTimeZone is equals clickhouse timezone , both are Asia/Shanghai.
In my app,I only want to query the fieldValue equals clickhouse value,both are 2022-03-31 19:31:15,I dont know why ClickHouseDateValueParser.dateTimeToLocalDateTime() trans the value to UTC time.
if this problem open in mysql ,i can add the serverTimezone=Asia/Shanghai after the connect url ,but clickhouse not have this connetcion param,i use the use_server_time_zone to the url but not use.
what should i do?
The text was updated successfully, but these errors were encountered: