ClickHouse / clickhouse-java

ClickHouse Java Clients & JDBC Driver
https://clickhouse.com
Apache License 2.0
1.43k stars 526 forks source link

clickhouse-jdbc password contains =? Connection failed. #1305

Open xiaowuyy opened 1 year ago

xiaowuyy commented 1 year ago

Describe the bug

password contains =?use clickhouse-jdbc connection failed.

Steps to reproduce

  1. clickhouse server version 21.8.8.1

  2. password AF.O4P=?m76.lHfa

  3. ru.yandex.clickhouse clickhouse-jdbc 0.3.2
  4. error message: Code: 516, e.displayText() = DB::Exception: apmhouse: Auth##****he username or password#*#*****ion 21.8.8.1)[N], server ClickHouseNode(addr=http:ip:port, db=system)@-609109239

    Expected behaviour

    connection success

    Code example

        Properties properties = new Properties();
        properties.setProperty("ssl", "true");
        properties.setProperty("sslmode", "NONE");
        properties.setProperty("user", "apmhouse");
        properties.setProperty("password", "AF.O4P=?m76.lHfa");
        Connection connection = DriverManager.getConnection(url, properties);

    Error log

    client: Code: 516, e.displayText() = DB::Exception: apmhouse: Auth##he username or password##ion 21.8.8.1)[N], server ClickHouseNode(addr=http:ip:port, db=system)@-609109239 server: 2023.04.03 15:46:54.681974 [ 456 ] {} DynamicQueryHandler: Request URI: /?extremes=0 2023.04.03 15:46:54.686019 [ 456 ] {} Access(user directories): apmhouse: Authentication failed: Code: 193, e.displayText() = DB::Exception: Invalid credentials, Stack trace (when copying this message, always include the lines below):

  5. ? @ 0x10273542 in /opt/apm-clickhouse/programs/clickhouse

  6. ? @ 0x519804f in /opt/apm-clickhouse/programs/clickhouse

  7. ? @ 0x4aad274 in /opt/apm-clickhouse/programs/clickhouse

  8. ? @ 0x4aaf101 in /opt/apm-clickhouse/programs/clickhouse

  9. ? @ 0xc6f5d6a in /opt/apm-clickhouse/programs/clickhouse

  10. ? @ 0xc71bb53 in /opt/apm-clickhouse/programs/clickhouse

  11. ? @ 0xc6f5d6a in /opt/apm-clickhouse/programs/clickhouse

  12. ? @ 0xca80ca7 in /opt/apm-clickhouse/programs/clickhouse

  13. ? @ 0xdc23d83 in /opt/apm-clickhouse/programs/clickhouse

  14. ? @ 0xdc24e01 in /opt/apm-clickhouse/programs/clickhouse

  15. ? @ 0xdc2ade9 in /opt/apm-clickhouse/programs/clickhouse

  16. ? @ 0xdc46a56 in /opt/apm-clickhouse/programs/clickhouse

  17. ? @ 0xe1e5bd9 in /opt/apm-clickhouse/programs/clickhouse

  18. ? @ 0xe1e64ee in /opt/apm-clickhouse/programs/clickhouse

  19. ? @ 0x102ede2e in /opt/apm-clickhouse/programs/clickhouse

  20. ? @ 0x102ea8f7 in /opt/apm-clickhouse/programs/clickhouse

  21. ? @ 0x8f3b in /usr/lib64/libpthread-2.28.so

  22. clone @ 0xf8570 in /usr/lib64/libc-2.28.so (version 21.8.8.1)

Configuration

Environment

ClickHouse server

mzitnik commented 1 year ago

@xiaowuyy is it happens in the latest version

xiaowuyy commented 8 months ago

clickhouse-jdbc version is 0.3.2 ,I set password exclusion =? Fix this bug

@mzitnik

nkdanta1 commented 2 weeks ago

Hi @mzitnik password contains + and connection failing.

version: 0.6.4

mzitnik commented 2 weeks ago

@chernser can you take a look

nkdanta1 commented 2 weeks ago

After using the encoded password, the issue was fixed.

String encodedPassword = URLEncoder.encode(password, StandardCharsets.UTF_8.toString());