This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

Pooledconnection with wrong user credentials timeouts without information

Windows 10 MariaDB 10.2.14 mariadb-java-client-2.3.0.jar

trying this with non existing user:

DriverManager.getConnection("jdbc:mariadb://localhost:3306/DB?user=schnurz&password=pop");

as expected returns immediately with :

java.sql.SQLInvalidAuthorizationSpecException: Access denied for user 'schnurz'@'localhost' (using password: YES)
	at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:232)
	at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:165)
	at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1199)
.......

but this:

DriverManager.getConnection("jdbc:mariadb://localhost:3306/DB?user=schnurz&password=pop&pool");

returns after 30 seconds with

java.sql.SQLNonTransientConnectionException: No connection available within the specified time (option 'connectTimeout': 30.000 ms)
	at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:234)
	at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.connException(ExceptionMapper.java:95)
	at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.connException(ExceptionMapper.java:91)
	at org.mariadb.jdbc.internal.util.pool.Pool.getConnection(Pool.java:397)
	at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:171)
	at org.mariadb.jdbc.Driver.connect(Driver.java:92)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	.......

and even the .SQLInvalidAuthorizationSpecException is eaten, so there is no way to find the cause. (I inspected the thrown exception within debug session in eclipse.)

This also occurs when using MariaDbPoolDataSource instead.

I would love to use pooledConnection, so any help would be appreciated.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.