Home > Database > Mysql Tutorial > mysql的驱动程序的加载

mysql的驱动程序的加载

WBOY
Release: 2016-06-06 09:45:32
Original
1397 people have browsed it

mysql

public class ConnectionDemo01 {
public static final String DBDRIVER ="org.git.mm.mysql.Driver";
public static void main(String[] args) {
try {
Class.forName(DBDRIVER);
} catch (Exception e) {
e.printStackTrace();
}
}
}
运行这段代码是会出现错误:
java.lang.ClassNotFoundException: org.git.mm.mysql.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at mysql.cn.ConnectionDemo01.main(ConnectionDemo01.java:7)
但是我的CLASSPATH是正确的,我重新设置了好几次了,不会有错的。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template