重构DML操作模块
//重构DML模板
public class JDBCTemplate {
public static int update(String sql,Object ...params) {
Connection connection = null;
PreparedStatement statement = null;
try {
//加载驱动,并且实例化连接对象
connection = JDBCUtil.getConnection();
//执行语句对象
statement = connection.prepareStatement(sql);
//给?加实参
for (int i=0;i<params.length;i++) {
//i+1表示的?占位符的索引开始从1开始,因为数组是从0开始的
statement.setObject(i+