swaldman / c3p0

a mature, highly concurrent JDBC Connection pooling library, with support for caching and reuse of PreparedStatements.
http://www.mchange.com/projects/c3p0
Other
1.28k stars 338 forks source link

C3P0 Driver Issue #172

Open mohitdilwaria opened 8 months ago

mohitdilwaria commented 8 months ago

Our application uses multitenancy, where the first tenant employs MariaDB, and the second tenant is configured to use MySQL 8. However, we have encountered a challenge where, for the second tenant using MySQL 8, the connection attempts seem to be made with the MariaDB JDBC driver instead. Despite providing the correct JDBC URL, username, and password for MySQL8, I'm receiving an error indicating that the connection is being attempted with the MariaDB JDBC driver. This has led to an "Access denied for user" exception

Below are the logs As you can see we have jdbcurl as mysql

2024-01-03T20:45:51,974 INFO [Slf4jMLog$Slf4jMLogger$InfoLogger] - [master] Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@260f2f53 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@4b3dde96 [ acquireIncrement -> 3, acquireRetryAttempts -> 5, acquireRetryDelay -> 3000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, identityToken -> z8kfsxb01lolnsvvvi22|6ce2146b, idleConnectionTestPeriod -> 0, initialPoolSize -> 25, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 6000, maxIdleTime -> 2800, maxIdleTimeExcessConnections -> 10, maxPoolSize -> 40, maxStatements -> 4000, maxStatementsPerConnection -> 0, minPoolSize -> 25, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@e616c43c [ description -> null, driverClass -> null, factoryClassLocation -> null, forceUseNamedDriverClass -> false, identityToken -> z8kfsxb01lolnsvvvi22|6674638a, jdbcUrl -> jdbc:mysql://192.168.56.101:3308/nitin, properties -> {user=**, password=**} ], preferredTestQuery -> null, privilegeSpawnedThreads -> false, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, extensions -> {}, factoryClassLocation -> null, identityToken -> z8kfsxb01lolnsvvvi22|317761a4, numHelperThreads -> 3 ] 2024-01-03T20:45:51,974 DEBUG [Slf4jMLog$Slf4jMLogger$DebugLogger] - [master] com.mchange.v2.resourcepool.BasicResourcePool@43a0e493 config: [start -> 25; min -> 25; max -> 40; inc -> 3; num_acq_attempts -> 5; acq_attempt_delay -> 3000; check_idle_resources_delay -> 0; max_resource_age -> 6000000; max_idle_time -> 2800000; excess_max_idle_time -> 10000; destroy_unreturned_resc_time -> 0; expiration_enforcement_delay -> 2500; break_on_acquisition_failure -> false; debug_store_checkout_exceptions -> false; force_synchronous_checkins -> false] 2024-01-03T20:45:51,975 DEBUG [Slf4jMLog$Slf4jMLogger$DebugLogger] - [master] Created new pool for auth, username (masked): 'ni**'. 2024-01-03T20:45:51,975 DEBUG [Slf4jMLog$Slf4jMLogger$DebugLogger] - [master] acquire test -- pool size: 0; target_pool_size: 25; desired target? 1 2024-01-03T20:45:51,975 DEBUG [Slf4jMLog$Slf4jMLogger$DebugLogger] - [master] awaitAvailable(): [unknown] 2024-01-03T20:45:51,981 DEBUG [Slf4jMLog$Slf4jMLogger$DebugLogger] - [] An exception occurred while acquiring a poolable resource. Will retry. java.sql.SQLInvalidAuthorizationSpecException: Could not connect: Access denied for user 'nitin'@'192.168.56.101' (using password: NO) at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:154) ~[mariadb-java-client-1.6.4.jar:?] at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:118) ~[mariadb-java-client-1.6.4.jar:?] at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.throwException(ExceptionMapper.java:92) ~[mariadb-java-client-1.6.4.jar:?] at org.mariadb.jdbc.Driver.connect(Driver.java:111) ~[mariadb-java-client-1.6.4.jar:?] at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175) ~[c3p0-0.9.5.5.jar:0.9.5.5]