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

前端 未结 18 2010
爱一瞬间的悲伤
爱一瞬间的悲伤 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条回答
  •  情歌与酒
    2020-11-22 15:59

    JDBC API mostly consists of interfaces which work independently of any database. A database specific driver is required for each database which implements the JDBC API.

    First download the MySQL connector jar from www.mysql.com, then:

    Right Click the project -- > build path -- > configure build path

    In the libraries tab press Add External Jar and select your jar.

提交回复
热议问题