com.mysql.jdbc.Driver driver=null;
Class.forName(driver);
Connection conn=null;
Statement stmt=null;
conn=DriverManager.getConnection(url);
stmt=conn.createStatement();
与
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn=DriverManager.getConnection(url);
Statement stmt=conn.createStatement();总觉得有区别,,但是又不知道区别在哪???然后里面的 Class.forName("com.mysql.jdbc.Driver").newInstance();网上资料牵扯到了工厂模式,还有对象实例的生命周期,老师说这只是个单例模式我真的糊涂了……6求求大侠们解决一下
Class.forName(driver);
Connection conn=null;
Statement stmt=null;
conn=DriverManager.getConnection(url);
stmt=conn.createStatement();
与
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn=DriverManager.getConnection(url);
Statement stmt=conn.createStatement();总觉得有区别,,但是又不知道区别在哪???然后里面的 Class.forName("com.mysql.jdbc.Driver").newInstance();网上资料牵扯到了工厂模式,还有对象实例的生命周期,老师说这只是个单例模式我真的糊涂了……6求求大侠们解决一下
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货