0

I'm getting an error at runtime saying that: could not load com.mysql.jdbc.driver

But when I'm setting the classpath then at run time I'm getting an error as could not load main class even though I had set up path in advance setting.

What should I do?

Kalamarico
  • 5,466
  • 22
  • 53
  • 70

2 Answers2

1

I had this problem recently and had to add the mysql-connector-java-8.0.11.jar to my library. https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.11 If you're using maven you can just add it in or else download the jar file.

Christopher
  • 66
  • 13
0

com.mysql.jdbc.Driver with a capital D. Also Class.forName no longer is needed; the jdbc:mysql: URL suffices.

Joop Eggen
  • 107,315
  • 7
  • 83
  • 138