Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.sql.SQLException: java.io.IOException: Failed to read boolean value, expect 0 (false) or 1 (true) but we got: 67 #2102

Open
sunqiaozz opened this issue Jan 22, 2025 · 12 comments
Labels
investigating Investigation of a root cause is on going module-jdbc JDBC driver

Comments

@sunqiaozz
Copy link

When you read clickhouse data using jdbc, the next() function of the ResultSet reports an error when you are halfway through reading ClickHouse data,java.sql.SQLException: java.io.IOException: Failed to read boolean value, expect 0 (false) or 1 (true) but we got: 67

@sunqiaozz sunqiaozz added the bug label Jan 22, 2025
@chernser chernser added module-jdbc JDBC driver investigating Investigation of a root cause is on going and removed bug labels Jan 22, 2025
@chernser
Copy link
Contributor

Good day, @sunqiaozz !
Would you please provide more details about the issue?
Stacktrace? version? What is query?

@sunqiaozz
Copy link
Author

Hi,brother
When I use the JDBC driver to connect to ClickHouse, I get the Connection, and then execute the SQL statement to get the ResultSet, and call the next() method to get the data, this error will occur after reading for some time.

ResultSet rs = executeQuery(sql);
while (rs.next()) {}

I tried to read ClickHouse's JDBC source code and found that it was currentRow = rowCursor.next() in the next() method of the ClickHouseResultSet class; An error occurred in the code

@Override
public boolean next() throws SQLException {
	ensureOpen();

	lastReadColumn = 0;
	boolean hasNext = true;
	if (hasNext()) {
		try {
			currentRow = rowCursor.next();
		} catch (UncheckedIOException e) {
			throw SqlExceptionUtils.handle(e);
		}
		rowNumber++;
	} else {
		currentRow = null;
		hasNext = false;
	}
	return hasNext;
}

Then I tried using the latest JDBC driver and it still didn't work

Good day, @sunqiaozz ! Would you please provide more details about the issue? Stacktrace? version? What is query?

@sunqiaozz
Copy link
Author

Good day, @sunqiaozz ! Would you please provide more details about the issue? Stacktrace? version? What is query?

brother,Do you have time?

@mshustov
Copy link
Member

@sunqiaozz could you provide a snippet of your program as was asked above?

@chernser
Copy link
Contributor

@sunqiaozz
yes, but I need information in the issue, too. Because it is how we share experience about problem to prevent them in future. :-)

@livk-cloud
Copy link

When I upgraded from 0.7.2 to 0.8.0, alter table user delete where reg_time=2024-01-25 was called to delete the data and the return went from 1 to 0

@sunqiaozz
Copy link
Author

brother,I mean I executed a normal query using jdbc, and then the rs.next() method, and this error occurred during my data read

Class.forName("com.clickhouse.jdbc.ClickHouseDriver");
Connection connection = DriverManager.getConnection(url,username,password);
Statement statement = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {}

@sunqiaozz could you provide a snippet of your program as was asked above?

@sunqiaozz
Copy link
Author

@sunqiaozz yes, but I need information in the issue, too. Because it is how we share experience about problem to prevent them in future. :-)

brother,Do you need sql?

@sunqiaozz
Copy link
Author

When I upgraded from 0.7.2 to 0.8.0, alter table user delete where reg_time=2024-01-25 被调用以删除数据,并且返回值从 1 变为 0

brother,Does version 0.8 also have this problem

@livk-cloud
Copy link

When I upgraded from 0.7.2 to 0.8.0, alter table user delete where reg_time=2024-01-25 被调用以删除数据,并且返回值从 1 变为 0

brother,Does version 0.8 also have this problem

I'm not quite sure about this issue, but it did occur when I upgraded to 0.8.0, but in the 0.7.2 release, it didn't happen

@chernser
Copy link
Contributor

@livk-cloud thank you for the info.
@livk-cloud @sunqiaozz
The problem is that in 0.8.0 JDBC is of a new implementation (as announced https://clickhouse.com/docs/en/integrations/java/jdbc-v2).
There is a system property clickhouse.jdbc.v1 to switch back to the old implementation clickhouse.jdbc.v1=true

@chernser
Copy link
Contributor

@sunqiaozz
yes, brother, I need an sql to reproduce the issue to fix it. It can be something similar to a real one, but that reproduces the issue.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating Investigation of a root cause is on going module-jdbc JDBC driver
Projects
None yet
Development

No branches or pull requests

4 participants