public class ConnectionDemo1
{
public static final String DBDriver="org.gjt.mm.mysql.Driver";
public static void main(String[] args)
{
try
{
Class div=Class.forName(DBDriver);
System.out.println("驱动加载成功!");
}
catch(ClassNotFoundException e)
{
System.out.println("驱动加载失败!");
e.printStackTrace();
}
}
}
驱动加载失败!
java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at ConnectionDemo1.main(ConnectionDemo1.java:8)
请按任意键继续. . .