jdbc流程
1.加载MySQL驱动
Class.forName(“com.mysql.jdbc.Driver”);
2.获取MySQL连接
Connetion con = DriverManager.getConnetion(url,root,password);
3.设置参数,预注入SQL语句
PrepareStatement prep = con.prepareStatement(“select * from dual”);
4.执行SQL,获取结果
ResultSet rs = prep.executeQuery();
5.释放连接˙
rs.close();
prep.close();
con.close();