clickhouse-java
clickhouse-java copied to clipboard
Select before insert with condition 'where 0'
When inserting into a table via executeBatch, before insert, Select is raised (which apparently checks for the presence of the required columns in the table) with Where 0. Is it possible to somehow disable this check? We are using 0.3.2-patch11 version with hikari pool
Can you provide a snippet? Did you tried to use the latest version?
same problem on latest version. My code:
public static void main(String[] args) {
HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:clickhouse://tkles-mess00065.vm.esrt.cloud.sbrf.ru:8123");
config.setUsername("user");
config.setPassword("password");
HikariDataSource ds = new HikariDataSource(config);;
try {
Connection connection = ds.getConnection();
String sql = "INSERT INTO sbol.test_jdbc_shard (name, surname) VALUES (?, ?)";
PreparedStatement statement = connection.prepareStatement(sql);
statement.setString(1, "test");
statement.setString(2, "test2");
statement.executeUpdate();
System.out.println("Records were inserted successfully!");
} catch (SQLException e) {
e.printStackTrace();
}
}
there are 2 queries in log:
SELECT name, surname FROM
sbol.
test_jdbc_shard WHERE 0
and
INSERT INTO sbol.test_jdbc_shard (name, surname) VALUES ('test', 'test2') FORMAT RowBinary
maven dependencies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.clickhouse</groupId>
<artifactId>clickhouse-jdbc</artifactId>
<version>0.3.2-patch11</version>
<exclusions>
<exclusion>
<groupId>com.clickhouse</groupId>
<artifactId>clickhouse-grpc-client</artifactId>
</exclusion>
</exclusions>
</dependency>