怎么jdbc连mysql有些地方看到的是:
Class.forName("org.gjt.mm.mysql.Driver").newInstance(); 
有些地方看到的是:
Class.forName(com.mysql.jdbc.Driver).newInstance();
到底哪个正确阿?

解决方案 »

  1.   

    static Class<?> forName(String className) 
              Returns the Class object associated with the class or interface with the given string name. static Class<?> forName(String name, boolean initialize, ClassLoader loader) 
              Returns the Class object associated with the class or interface with the given string name, using the given class loader. 这种东西查一下api不就有了,或者编译一下不是也出来了,用得着上来发贴吗
      

  2.   

    org.gjt.mm.mysql.Driver这个是旧版本的驱动.
    com.mysql.jdbc.Driver是新版本的驱动,新版本中仍然保持这旧版本的驱动类,所以org.gjt.mm.mysql.Driver还可以用,但不建议用.