java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in Eclipse

前端 未结 18 2152
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 15:41

What is wrong with the code there are lots of error while debugging. I am writing a code for a singleton class to connect with the database mysql.

Here is my code

18条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 15:54

    If you got the error in your IDE(compile-time error), you need to add your mysql-connector jar file to your libs and add this to your referenced library of project too.

    If you get this error when you are running it, then probably its because you have not included mysql-connector JAR file to your webserver's lib folder.

    Add mysql-connector-java-5.1.25-bin.jar to your classpath and also to your webserver's lib directory. Tomcat lib path is given as an example Tomcat 6.0\lib

提交回复
热议问题