mysql multiple dependency conflict

hello, i`m backend developer worked in south KOREA

i have a problem about mysql dependency conflict

i want to use 2 data source (DB: mysql) in spring boot project
but, mysql version is different (one is 5.0 the other is 8.0)

so, I add dependency like this in build.gradle


but, gradle is support only one dependency if group and name is same

who can think like this, mysql 8.0 connector can connect lover mysql version
so, i checked that : mysql 8.0 driver can connect lowest mysql version is 5.7

what i find the other way is
mysql 5.0 is connected by mysql-connector-java
and mysql 8.0 is connected by mariadb-java-client

but, i don`t want to solve this problem like this…
this is just makeshift

please give me a other way…
Thank you

Including both jars would probably be pretty easy, but would not really help you.
If you put both on the same classpath, but buth have the same classes inside, the first one on the classpath would win and the other be ignored, except for classes only in that artifact which could then again have problems when using other classes from the other artifact.

So if you really need that, you anyway need to make a bigger plan how you separate those connectors, maybe by loading from different separate sibling class loaders or similar, I don’t know how, especially within your project.

Maybe you could also use an older Connector/J version that still supports 5.0.
Chances are, that it also supports newer versions even if maybe not as efficient as it could be.