clickhouse-java icon indicating copy to clipboard operation
clickhouse-java copied to clipboard

clickhouse-jdbc password contains =? Connection failed.

Open xiaowuyy opened this issue 1 year ago • 5 comments

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. <dependency>
         <groupId>ru.yandex.clickhouse</groupId>
         <artifactId>clickhouse-jdbc</artifactId>
         <version>0.3.2</version>
     </dependency>
    
  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 ] {} <Trace> DynamicQueryHandler: Request URI: /?extremes=0 2023.04.03 15:46:54.686019 [ 456 ] {} <Error> 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):

  1. ? @ 0x10273542 in /opt/apm-clickhouse/programs/clickhouse
  2. ? @ 0x519804f in /opt/apm-clickhouse/programs/clickhouse
  3. ? @ 0x4aad274 in /opt/apm-clickhouse/programs/clickhouse
  4. ? @ 0x4aaf101 in /opt/apm-clickhouse/programs/clickhouse
  5. ? @ 0xc6f5d6a in /opt/apm-clickhouse/programs/clickhouse
  6. ? @ 0xc71bb53 in /opt/apm-clickhouse/programs/clickhouse
  7. ? @ 0xc6f5d6a in /opt/apm-clickhouse/programs/clickhouse
  8. ? @ 0xca80ca7 in /opt/apm-clickhouse/programs/clickhouse
  9. ? @ 0xdc23d83 in /opt/apm-clickhouse/programs/clickhouse
  10. ? @ 0xdc24e01 in /opt/apm-clickhouse/programs/clickhouse
  11. ? @ 0xdc2ade9 in /opt/apm-clickhouse/programs/clickhouse
  12. ? @ 0xdc46a56 in /opt/apm-clickhouse/programs/clickhouse
  13. ? @ 0xe1e5bd9 in /opt/apm-clickhouse/programs/clickhouse
  14. ? @ 0xe1e64ee in /opt/apm-clickhouse/programs/clickhouse
  15. ? @ 0x102ede2e in /opt/apm-clickhouse/programs/clickhouse
  16. ? @ 0x102ea8f7 in /opt/apm-clickhouse/programs/clickhouse
  17. ? @ 0x8f3b in /usr/lib64/libpthread-2.28.so
  18. clone @ 0xf8570 in /usr/lib64/libc-2.28.so (version 21.8.8.1)

Configuration

Environment

  • Client version: 0.3.2
  • Language version:
  • OS:

ClickHouse server

  • ClickHouse Server version: 21.8.8.1
  • ClickHouse Server non-default settings, if any:
  • CREATE TABLE statements for tables involved:
  • Sample data for all these tables, use clickhouse-obfuscator if necessary

xiaowuyy avatar Apr 03 '23 07:04 xiaowuyy

@xiaowuyy is it happens in the latest version

mzitnik avatar Aug 13 '23 15:08 mzitnik

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

@mzitnik

xiaowuyy avatar Jan 11 '24 11:01 xiaowuyy

Hi @mzitnik password contains + and connection failing.

version: 0.6.4

nkdanta1 avatar Aug 21 '24 12:08 nkdanta1

@chernser can you take a look

mzitnik avatar Aug 21 '24 13:08 mzitnik

After using the encoded password, the issue was fixed.

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

nkdanta1 avatar Aug 21 '24 16:08 nkdanta1