I am writing a simple Flink program to move data from MySQL to Mongo.
I'm using mysql-connector-java 8.0.16.
The problem
When I try to connect to our test env DB (MySQL 8.0.15) the program works just fine. The connection string looks like this:
jdbc:mysql://my-test-db-url:3306/my_db_name
But once I connect it to our production DB (MySQL 8.0.16), I got:
java.sql.SQLException: No suitable driver found for jdbc:mysql://my-prod-db-url:3306/my_db_name
The only difference of these DBs is the minor version (15 vs 16).
What I have tried
Upgrading test DB to match prod DB version
I upgraded my test DB to 8.0.16 to see if it's a problem with that version of mysql server. And indeed now I can't connect to test DB, too, getting the same exception.
After that I continued to upgrade both mysql-connector-java and test DB to 8.0.17, but the problem still persists.
In my other projects I can connect to those mysql DBs just fine (using spring data jpa with mysql-connector-java 8.0.18). So the db server shouldn't have any problem.
Manually put mysql-connector-java jar into flink/lib folder
This didn't work
Registering the driver manually in main class and my mysql source function's open method
no error was thrown in main class
// tried both
Class.forName("com.mysql.jdbc.Driver").newInstance();
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
I also made sure after running maven package, my fat jar does contain the connector class files.
Now I'm pretty much clueless. Somebody please save me.