1 : import ==> loads the class when you call any instance of it or call anything by class reference==> loads the class when call is made2 : Class.forName("");==> loads the class in the jvm immediately如果类具有静态块,则可以看出差异
==> import will not call the static block==> Class.forName("") will call the static block在你的情况下
===> Driver class when loaded by Class.forName("") , executes its static block , which published the driver==> Simply importing the Driver class wont execute the static block and thus your Driver will not be published for connection objects to be created


