private List<Station> getDataSet(String startTime, String endTime) { List<Station> listStation = new ArrayList<Station>(); try { // Connecting the database Connection cn = DB.getConn(); System.out.println("Searching.."); String sql = "select AVG(nbBikes) as vc,BIXI.station_id,BIXI_STATIONS.station_name,BIXI.datetime from BIXI INNER JOIN BIXI_STATIONS ON BIXI.station_id = BIXI_STATIONS.station_id WHERE BIXI.datetime >= timestamp('" + startTime + "') and BIXI.datetime <= timestamp('" + endTime + "')GROUP BY station_name order by vc desc limit 10"; PreparedStatement ps = cn.prepareStatement(sql); ResultSet rs = ps.executeQuery(); System.out.println("End"); while (rs.next()) { Station station = new Station(); station.setVc(rs.getInt(1)); station.setStation_id(rs.getInt(2)); station.setStation_name(rs.getString(3)); station.setDatatime(new java.util.Date(rs.getDate(4).getTime())); listStation.add(station); } } catch (Exception e) { e.printStackTrace(); } return listStation; }