Open yanye666 opened 1 month ago
When I set the object property string to "1970-01-01 00:00:00" ,throw exception,below the debug
When I set the object property string to "1970-01-01 08:00:00" ,avoid exception,database query show
Good day, @yanye666 !
How do you set null timestamp?
Here is my code that works for latest version 0.6.2
try (ClickHouseConnection conn = newConnection(props);
PreparedStatement ps = conn.prepareStatement("select toDateTime(?)")) {
ps.setTimestamp(1, null);
ResultSet rs = ps.executeQuery();
Assert.assertTrue(rs.next());
Assert.assertNull(rs.getObject(1));
}
Thanks!
Good day, @yanye666 !
How do you set null timestamp?
Here is my code that works for latest version 0.6.2
try (ClickHouseConnection conn = newConnection(props); PreparedStatement ps = conn.prepareStatement("select toDateTime(?)")) { ps.setTimestamp(1, null); ResultSet rs = ps.executeQuery(); Assert.assertTrue(rs.next()); Assert.assertNull(rs.getObject(1)); }
Thanks!
I'm not set null.I want to insert the default 1970 timestamp to avoid clickhouse nullable. But as shown in the figure, I have to set 1970-01-01 08:00:00, otherwise I will report an error.Inspection of the first diagram
Still got this problem in version:0.3.2-patch11, When I set 0 or null timestamp to ClickHouse DataTime column,I got this err
DateTime(-28800) should between 0 and 4294967295000 inclusive of both values
Originally posted by @cod-soap in https://github.com/ClickHouse/clickhouse-java/issues/999#issuecomment-1445802811