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

Migration from ru.yandex.clickhouse-jdbc 0.3.1-patch to com.clickhouse-jdbc 0.6.0

Open Nomad06 opened this issue 1 year ago • 1 comments
trafficstars

Hey, folks! I am trying to make a migration from ru.yandex.clickhouse-jdbc 0.3.1-patch to com.clickhouse-jdbc 0.6.0 I see a lot of changes there and I changed most part of our code base, but I struggle to find alternatives for binary read. Here is the code from old version:

public void readBinary(String sql, IOConsumer inputStreamConsumer)
throws IOException {
    try (ClickHouseStatement statement = connection.createStatement();
        ClickHouseRowBinaryInputStream inputStream = statement.executeQueryClickhouseRowBinaryStream(sql)
    ) {
        inputStreamConsumer.accept(inputStream);
    } catch (SQLException e) {
        throw new RuntimeSQLException("Failed to execute query: " + sql, e);
    }
}

We are using ClickHouseRowBinaryInputStream for our purposes but I see that this class and whole packege was removed. I made new version using ResultSet, but I want to know is it possible to make something similar in new version. In such case I don't need to make too much changes in the code. Also after update when I try to read string date from resultset using resultSet.getString(column_index) I can't get date as I can see it in db for example in db I see: 2020-06-03 06:51:00.000 but I get string 2020-06-03 06:51:00

Could you educate me about these things?

Nomad06 avatar Jan 29 '24 11:01 Nomad06

Is column type Date or DateTime?

dolfinus avatar Mar 27 '24 22:03 dolfinus