I have an issue with a java BasicDataSource connection pool.
My ProxySql is correctly configured on all my DataProc Compute engine, if I try to connect to my CloudSql instance with sqlclient it works correctly. When I try to connect to my CloudSql from my connection pool, configured with this connection string: pooljdbc:mysql://127.0.0.1/my_db?serverTimezone=UTC, I get this error:
Cannot create PoolableConnectionFactory (Access denied for user 'myuser'@'localhost' (using password: YES))
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'myuser'@'localhost' (using password: YES))
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
And is correct because the proxySQL tcp connection is on 127.0.0.1 and not on localhost (unix socket).
I don't understand why the BasicDataSource try to connect on localhost and not on 127.0.0.1 as I have configured in the connection string.
Any help is really appreciated.