Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

323
Views
Using mysql-connector-java in Flink: No suitable driver found when connecting to mysql >= 8.0.16

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.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I resolved same issue using Class.forName("org.sqlite.JDBC") (I were using sqlite) before calling DriverManager.getConnection. It's almost same that you've tried but without calling newInstance().

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!