-
Notifications
You must be signed in to change notification settings - Fork 614
Closed
Labels
area:jdbc-metadataissue handling metadata things like getting type of columnissue handling metadata things like getting type of columnbugjdbc-v2jdbc-v2 issuesjdbc-v2 issues
Description
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
- Cloud
- Client version: clickhouse-jdbc-0.8.6-shaded-all.jar
- Language version:
- OS:
ClickHouse Server
- ClickHouse Server version:
- ClickHouse Server non-default settings, if any:
CREATE TABLEstatements for tables involved:- Sample data for all these tables, use clickhouse-obfuscator if necessary
Metadata
Metadata
Assignees
Labels
area:jdbc-metadataissue handling metadata things like getting type of columnissue handling metadata things like getting type of columnbugjdbc-v2jdbc-v2 issuesjdbc-v2 issues