public static void execute(DataSource dataSource, String sql, List<Object> parameters) throws SQLException { Connection conn = null; try { conn = dataSource.getConnection(); execute(conn, sql, parameters); } finally { close(conn); } }
public static void insertToTable(Connection conn, String tableName, Map<String, Object> data) throws SQLException { String sql = makeInsertToTableSql(tableName, data.keySet()); List<Object> parameters = new ArrayList<Object>(data.values()); execute(conn, sql, parameters); }
public static void execute(DataSource dataSource, String sql, Object... parameters) throws SQLException { execute(dataSource, sql, Arrays.asList(parameters)); }