PreparedStatement insert batch sql NullPointerException
issuse : batch insert data failed which contains json type
driver version:
test sql:
insert into test.zx1 (id, name, test) values (?, ?, ?)
code:
public void insert(String sql, JSONObject data) throws SQLException {
PreparedStatement preparedStatement = connection.prepareStatement(sql);
ClickHousePreparedStatement clickHousePreparedStatement = (ClickHousePreparedStatement) preparedStatement;
clickHousePreparedStatement.setInt(1, data.getInteger("id"));
clickHousePreparedStatement.setString(2, data.getJSONObject("name").toJSONString());
clickHousePreparedStatement.setInt(3, 4);
clickHousePreparedStatement.addBatch();
clickHousePreparedStatement.executeBatch();
}
exception:

Hi @zhang18888888888, which version of ClickHouse server you're using? Before ClickHouse/ClickHouse#39866 can be fixed, you may use the workaround mentioned at #1023 for dealing with JSON.
Hi @zhang18888888888, which version of ClickHouse server you're using? Before ClickHouse/ClickHouse#39866 can be fixed, you may use the workaround mentioned at #1023 for dealing with JSON. i am using 22.10.1.1877.x86_64 version using String type it works well, but i need json scene and my json data has deep nesting levels
This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!
This issue has been automatically closed because it has not had any further activity in the last 30 days. Thank you for your contributions!