runtime error: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

前端 未结 6 1190
刺人心
刺人心 2020-11-28 16:13

I am new to mysql and jdbc and I am getting the error in this title. I have been searching all day and cannot find a solution that works for me.

What I have tried:

6条回答
  •  旧巷少年郎
    2020-11-28 16:56

    What did you import ? From the documentation: http://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-connect-drivermanager.html

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    // Notice, do not import com.mysql.jdbc.*
    // or you will have problems!
    

    Comment:

    Why are you using notepad++ ? install an IDE (Eclipse/Netbeans/IntelliJ) - it'll be much easier to locate such problems (un-included jars for example)

提交回复
热议问题