Description
If the query contains column names like "ip" or "url" then PreparedStatement 's setObject() or any set methods throw java.lang.ArrayIndexOutOfBoundException
Steps to reproduce
- Create a simple table in clickhouse
CREATE TABLE myusers ( id UInt64, ip String, url String, tenant String) ENGINE = MergeTree() PRIMARY KEY (id);
- Write a simple query "select ip from myusers where tenant=?" in java code
- Use connection.prepareStatement(query) to generate
PreparedStatement object
- Call setObject(1,1) on prepare statement object
same observed for url
Error Log or Exception StackTrace
java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at com.clickhouse.jdbc.PreparedStatementImpl.setObject(PreparedStatementImpl.java:291)
Expected Behaviour
It should allow setting objects in PreparedStatement without exception
Code Example
String query = "select ip from myusers where tenant=?";
PreparedStatement ps = connection.prepareStatement(query);
ps.setObject(1, 1);
Configuration
Client Configuration
<dependency>
<groupId>com.clickhouse</groupId>
<artifactId>clickhouse-jdbc</artifactId>
<version>0.9.2</version>
<classifier>all</classifier>
</dependency>
and also observed same for 0.9.1 version
<dependency>
<groupId>com.clickhouse</groupId>
<artifactId>clickhouse-jdbc</artifactId>
<version>0.9.1</version>
<classifier>all</classifier>
</dependency>
Environment
ClickHouse Server
- ClickHouse Server version: 25.3.6.56-lts
- ClickHouse Server non-default settings, if any:
CREATE TABLE statements for tables involved:
- Sample data for all these tables, use clickhouse-obfuscator if necessary
Description
If the query contains column names like "ip" or "url" then
PreparedStatement'ssetObject()or any set methods throwjava.lang.ArrayIndexOutOfBoundExceptionSteps to reproduce
CREATE TABLE myusers ( id UInt64, ip String, url String, tenant String) ENGINE = MergeTree() PRIMARY KEY (id);PreparedStatementobjectsame observed for url
Error Log or Exception StackTrace
Expected Behaviour
It should allow setting objects in
PreparedStatementwithout exceptionCode Example
Configuration
Client Configuration
and also observed same for 0.9.1 version
Environment
ClickHouse Server
CREATE TABLEstatements for tables involved: