com.mysql.jdbc.Driver not found with mysql connector in buildpath

那年仲夏 提交于 2019-11-29 12:46:21

The answer was quite tricky for me to find but i figure it out. It was ofcourse classpath problem.

If you ever encounter a problem like this and try to solve it inside eclipse, go to

eclipse -> window -> preferences -> java -> buildpath -> classpath

and add the

"mysql-connector-java-5.1.22-bin.jar"

as new variable. Name it whatever you like. Hope this helps.

You need to make sure you have the proper libraries and jar files loaded in your project. I dealt with this a lot when working with postgresql. I would think you're just missing the jar file.

beplaya

This was my problem which was answered here: SO Link

"If this code works in your J2SE it means you need to have a JAR file somewhere containing com.mysql.jdbc.Driver class (so called JDBC driver). This JAR needs to be visible in Tomcat. So, I would suggest to place mysql-jdbc.jar at physical location to /WEB-INF/lib directory of your project." From

I've been looking for a solution everywhere. Maybe this is not your solution, but using Eclipse i was exporting as a JAR file and got same exception, but then exported as "Runnable JAR"and it worked.

If you use netbeans then do the followings: go to your application>>>libraries>>add jar (by right click)>> "mysql-connector-java-5.1.22-bin.jar"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!