package com.sf.jdbctest; import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSourceFactory; import com.alibaba.druid.util.JdbcUtils; import org.apache.commons.dbutils.DbUtils; import org.junit.Test; import javax.sql.DataSource; import java.io.IOException; import java.lang.reflect.Field; import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.Properties; import static sun.plugin.javascript.navig.JSType.URL; /** * 通过数据库的操作类 * @param */ public class BaseDao { /** * 通过的增删改 */ public void update(Connection conn,String sql,Object...args) throws SQLException { PreparedStatement ps = conn.prepareStatement(sql); //赋值 if(args != null && args.length>0){ for (int i = 0;i getList(Connection connection , String sql ,Class clazz ,Object...args)throws SQLException, InstantiationException, IllegalAccessException, NoSuchFieldException, SecurityException { List list = new ArrayList<>(); T t = null; //获取PreparedStatement PreparedStatement ps = connection.prepareStatement(sql); //赋值 if(args!=null && args.length>0) { for(int i=0;i clazz,Object ...args) throws SQLException, InstantiationException, IllegalAccessException, NoSuchFieldException, SecurityException { T t = null; //获取PreparedStatement PreparedStatement ps = connection.prepareStatement(sql); //赋值 if(args!=null && args.length>0) { for(int i=0;i clazz,Object ...args) throws SQLException, InstantiationException, IllegalAccessException, NoSuchFieldException, SecurityException, InvocationTargetException, NoSuchMethodException { // T t = null; // //获取PreparedStatement // PreparedStatement ps = connection.prepareStatement(sql); // //赋值 // if(args!=null && args.length>0) { // for(int i=0;i