Description
Result of connection.isValid() returned true even incorrect credentials provided
Steps to reproduce
- using provided code example, give correct host
- give incorrect username and password
- run the code, it will return "Connection to ClickHouse is valid.".
Error Log or Exception StackTrace
Expected Behaviour
Return false if credential incorrect
Code Example
import java.sql.Connection;
import java.sql.DriverManager;
public class ClickHouseConnectionTest {
public static void main(String[] args) {
String url = "jdbc:clickhouse://<host>:<port>/<database>";
String user = "incorrectuser"; // optional
String password = "incorrectpwd"; // optional
try (Connection connection = DriverManager.getConnection(url, user, password)) {
if (connection.isValid(5)) {
System.out.println("Connection to ClickHouse is valid.");
} else {
System.out.println("Connection established, but not valid.");
}
} catch (Exception e) {
System.err.println("Failed to connect to ClickHouse:");
e.printStackTrace();
}
}
}
Configuration
Client Configuration
Environment
ClickHouse Server
- ClickHouse Server version:
- 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
Result of connection.isValid() returned true even incorrect credentials provided
Steps to reproduce
Error Log or Exception StackTrace
Expected Behaviour
Return false if credential incorrect
Code Example
Configuration
Client Configuration
Environment
ClickHouse Server
CREATE TABLEstatements for tables involved: