Description
After upgrading to 0.3.1 I'm facing the following error:
ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 6, host: ip6-localhost, port: 8123; Code: 6, e.displayText() = DB::Exception: Cannot parse string '2021-05-06 09:59:19.475027700' as DateTime: syntax error at position 19 (parsed just '2021-05-06 09:59:19'): while executing 'FUNCTION CAST(assumeNotNull(_dummy_0) :: 2, 'DateTime' :: 1) -> CAST(assumeNotNull(_dummy_0), 'DateTime') DateTime : 4' (version 21.4.4.30 (official build)) , query: insert into transactional_events (transactional_id, type, email, user_id, info, domain_name, created_at, event_date) values (?, ?, ?, ?, ?, ?, ?, ?), params: 722310ea-877c-4b97-a97e-109ea4e60fe4, 2, test@contact.co, 209897, { "subject":"Before"}, contact.co, 2021-05-06 09:59:19.4750277, 2021-05-06 at org.javalite.activejdbc.DB.exec(DB.java:657)
the timestamp parameter is set as an Object:
PreparedStatement.setObject(index, param)
This worked fine in 0.2.6
Activity
zhicwu commentedon May 7, 2021
Is the target column not
DateTime64?alniks commentedon May 7, 2021
No, just DateTime
zhicwu commentedon Dec 29, 2021
Please try the new JDBC driver
com.clickhouse.jdbc.ClickHouseDriver, which now has better support of DateTime values. Also please usejava.time.LocalDateTimeinstead ofjava.sql.Timestamp, and usePrepareStatement.setObjectto set value. There are a few examples at here.