java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at util.DBHelper.<clinit>(DBHelper.java:17)
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/shopping?useUnicode=true&characterEncoding=UTF-8
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at util.DBHelper.getConnection(DBHelper.java:27)
at util.DBHelper.main(DBHelper.java:35)
其实,你可以去看看class.forName("com.mysql.jdbc.Driver");句话是干啥,然后,再去驱动包中看看,你就明白,这段代码很有意思的。
我的错我的错,忘记导入jar包了 ~~~~~~~
mysql都启动了,数据库也链接了,不知道为什么还会这样
?????