-
Couldn't load subscription status.
- Fork 613
Open
Labels
Milestone
Description
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
PreparedStatementobject - 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
- Cloud
- Client version: java jdbc v2 0.9.2 and 0.9.1
- Language version: Java 17
- OS:
ClickHouse Server
- ClickHouse Server version: 25.3.6.56-lts
- ClickHouse Server non-default settings, if any:
CREATE TABLEstatements for tables involved:- Sample data for all these tables, use clickhouse-obfuscator if necessary