impossibl / pgjdbc-ng

A new JDBC driver for PostgreSQL aimed at supporting the advanced features of JDBC and Postgres
https://impossibl.github.io/pgjdbc-ng
Other
596 stars 108 forks source link

SCRAM channel binding check failed #582

Open duncte123 opened 1 year ago

duncte123 commented 1 year ago

Workaround

For the people looking for a workaround: use this lib instead https://mvnrepository.com/artifact/org.postgresql/postgresql

Original issue

When setting ssl.mode to require on a hosted server (psql version 15.1) I get the following exception, it does work if I disable SSL in my settings somehow

jdbc uri:

jdbc:pgsql://(digital ocean hosted db)/skybot?user=skybot&password=REDACTED&ssl.mode=require

Exception

12-11-2022 11:56:46 main  HikariPool      ERROR  HikariPool-1 - Exception during pool initialization.
com.impossibl.postgres.jdbc.PGSQLSimpleException: Connection Error: SCRAM channel binding check failed
    at com.impossibl.postgres.jdbc.ErrorUtils.makeSQLException(ErrorUtils.java:197)
    at com.impossibl.postgres.jdbc.ErrorUtils.makeSQLException(ErrorUtils.java:134)
    at com.impossibl.postgres.jdbc.ConnectionUtil.createConnection(ConnectionUtil.java:326)
    at com.impossibl.postgres.jdbc.ConnectionUtil.createConnection(ConnectionUtil.java:279)
    at com.impossibl.postgres.jdbc.PGDriver.connect(PGDriver.java:104)
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121)
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
    at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
    at ml.duncte123.skybot.database.PostgreDatabase.<init>(PostgreDatabase.kt:56)
    at ml.duncte123.skybot.Variables.getDatabase(Variables.java:176)
    at ml.duncte123.skybot.commands.fun.TagCommand.<init>(TagCommand.java:63)
    at ml.duncte123.skybot.CommandManager.<init>(CommandManager.java:281)
    at ml.duncte123.skybot.Variables.<init>(Variables.java:90)
    at ml.duncte123.skybot.SkyBot.<init>(SkyBot.java:67)
    at ml.duncte123.skybot.SkyBot.main(SkyBot.java:187)
Exception in thread "main" com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Connection Error: SCRAM channel binding check failed
    at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:582)
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
    at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
    at ml.duncte123.skybot.database.PostgreDatabase.<init>(PostgreDatabase.kt:56)
    at ml.duncte123.skybot.Variables.getDatabase(Variables.java:176)
    at ml.duncte123.skybot.commands.fun.TagCommand.<init>(TagCommand.java:63)
    at ml.duncte123.skybot.CommandManager.<init>(CommandManager.java:281)
    at ml.duncte123.skybot.Variables.<init>(Variables.java:90)
    at ml.duncte123.skybot.SkyBot.<init>(SkyBot.java:67)
    at ml.duncte123.skybot.SkyBot.main(SkyBot.java:187)
Caused by: com.impossibl.postgres.jdbc.PGSQLSimpleException: Connection Error: SCRAM channel binding check failed
    at com.impossibl.postgres.jdbc.ErrorUtils.makeSQLException(ErrorUtils.java:197)
Caused by: com.impossibl.postgres.jdbc.PGSQLSimpleException: Connection Error: SCRAM channel binding check failed
    at com.impossibl.postgres.jdbc.ErrorUtils.makeSQLException(ErrorUtils.java:134)
    at com.impossibl.postgres.jdbc.ConnectionUtil.createConnection(ConnectionUtil.java:326)
    at com.impossibl.postgres.jdbc.ConnectionUtil.createConnection(ConnectionUtil.java:279)
    at com.impossibl.postgres.jdbc.PGDriver.connect(PGDriver.java:104)
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121)
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
    ... 9 more
mipper commented 1 year ago

I get the same thing.


java.lang.RuntimeException: com.impossibl.postgres.jdbc.PGSQLSimpleException: Connection Error: SCRAM channel binding check failed

Caused by: com.impossibl.postgres.jdbc.PGSQLSimpleException: Connection Error: SCRAM channel binding check failed
    at com.impossibl.postgres.jdbc.ErrorUtils.makeSQLException(ErrorUtils.java:197)
    at com.impossibl.postgres.jdbc.ErrorUtils.makeSQLException(ErrorUtils.java:134)
    at com.impossibl.postgres.jdbc.ConnectionUtil.createConnection(ConnectionUtil.java:326)
    at com.impossibl.postgres.jdbc.AbstractDataSource.createConnection(AbstractDataSource.java:125)
    at com.impossibl.postgres.jdbc.PGDataSource.getConnection(PGDataSource.java:71)
    at com.impossibl.postgres.jdbc.PGDataSource.getConnection(PGDataSource.java:63)
    ... 30 more
clrxbl commented 1 year ago

Can confirm that this is still happening. Disabling SSL isn't an option here since our PostgreSQL server requires it.

duncte123 commented 1 year ago

Can confirm that this is still happening. Disabling SSL isn't an option here since our PostgreSQL server requires it.

I ended up switching to https://mvnrepository.com/artifact/org.postgresql/postgresql. It solved all my issues with this lib