JDBC cannot log in to PostgreSQL: authentication type 10
org.postgresql.util.PSQLException: The authentication type 10 is not supported.Short answer
Authentication type 10 is SCRAM-SHA-256, the password method PostgreSQL 14 and later use by default. A JDBC driver older than 42.2.0 does not speak it. Upgrade the postgresql driver in Gradle or Maven. Only if you cannot, store that role's password with md5 and match pg_hba.conf, knowing md5 is deprecated.
Fix it fast
1Find out which cause you have
Find the PostgreSQL driver version your build pulls in.
./gradlew dependencies --configuration runtimeClasspath | grep -i postgresql2Match what you see, then jump to its fix
- 1
The first step shows an org.postgresql:postgresql version below 42.2.0, often pinned by hand or by an old Spring Boot BOM.The JDBC driver is older than 42.2.0Fix - 2
The build shows a new driver, but the running app still fails, for example inside an app server or a fat jar from another project.A shaded or bundled old driver wins on the classpathFix - 3
You cannot upgrade the client in time.Last resort: the role needs an md5 passwordFix
- 1
What does the error look like?
org.postgresql.util.PSQLException: The authentication type 10 is not supported.
Cause 1 of 3
The JDBC driver is older than 42.2.0
1Check
SCRAM-SHA-256 support arrived in pgjdbc 42.2.0 and works from Java 8. An older driver does not recognise the server's request.
grep -rn "org.postgresql" build.gradle build.gradle.kts pom.xml 2>/dev/null2Fix
Remove the old pin or set a current version. With Spring Boot, drop the version so the BOM manages it.
// build.gradle
runtimeOnly 'org.postgresql:postgresql'3Verify
The listed version is 42.2.0 or higher, and the app connects.
./gradlew dependencies --configuration runtimeClasspath | grep -i postgresqlConfirmed by raw.githubusercontent.com
Cause 2 of 3
A shaded or bundled old driver wins on the classpath
1Check
Another jar can carry its own older copy of org.postgresql classes. Look at what the runtime really contains.
unzip -l build/libs/app.jar | grep -i postgresql
find / -name "postgresql*.jar" 2>/dev/null | head2Fix
Remove the duplicate so one current driver is left, including copies in an application server's lib folder.
# delete or replace the old postgresql-*.jar in the server's lib directory3Verify
Restart and connect.
./gradlew bootRunConfirmed by raw.githubusercontent.com
Cause 3 of 3
Last resort: the role needs an md5 password
1Check
The hash type is fixed when the password is set, using password_encryption. md5 is deprecated and will be removed in a future PostgreSQL release.
SHOW password_encryption;
SELECT rolname, left(rolpassword, 10) FROM pg_authid WHERE rolname = 'app';2Fix
Set the password for that one role again while password_encryption is md5, and let pg_hba.conf use md5 for it. Plan the driver upgrade, then go back to scram-sha-256.
SET password_encryption = 'md5';
ALTER ROLE app WITH PASSWORD 'new-password';
-- pg_hba.conf
-- host app_db app 10.0.0.0/8 md53Verify
Reload the config and connect with the old client.
SELECT pg_reload_conf();Confirmed by postgresql.org
How do I stop it coming back?
- Let the framework BOM manage the PostgreSQL driver version.
- Before moving a server to scram-sha-256, check every client library supports it.
- After changing password_encryption, set each password again: existing hashes are not converted.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
- Nuclear Home VideoA video-streaming Android app built from scratch, engineered for smooth playback.
Related fixes
Databases
Flyway cannot handle the PostgreSQL URL after upgrading to Flyway 10 or newer
No database found to handle jdbc:postgresql://localhost:5432/app
Since Flyway 10, each database has its own module.
4 causes, each with a fixDatabases
H2 in PostgreSQL mode still behaves differently from PostgreSQL
Names or null ordering differ from PostgreSQL in test results
H2 compatibility modes are switched on in the JDBC URL and cover only a small part of the differences between databases.
4 causes, each with a fixDatabases
Hibernate cannot find the sequence hibernate_sequence on PostgreSQL
ERROR: relation "hibernate_sequence" does not exist
Hibernate 6 no longer uses one shared hibernate_sequence.
3 causes, each with a fixDatabases
PSQLException: column user0_.id does not exist in a Hibernate query
org.postgresql.util.PSQLException: ERROR: column user0_.id does not exist
Hibernate generated SQL that names a column PostgreSQL does not have under that exact name.
3 causes, each with a fixDatabases
Spring Boot fails on startup: HikariPool-1 exception during pool initialization
Caused by: ... (the underlying driver exception)
HikariCP opens one connection when the pool starts, and the startup fails when that connection fails.
3 causes, each with a fixDatabases
PostgreSQL cannot work out the type of a null query parameter from Hibernate
org.postgresql.util.PSQLException: ERROR: function lower(bytea) does not exist
PostgreSQL works out an unspecified parameter's type from the place where it is first used.
3 causes, each with a fix