public CachedRowSet getSelectedData(String tableName, List<String> cols) throws MainException{
		try{
			CachedRowSet crs = new CachedRowSetImpl();

			String query = "SELECT DISTINCT " + cols.get(0);
			for(int i=1; i<cols.size(); i++){
				query += ", "+cols.get(i);
			}
			query += " FROM " +tableName;

			query += " ORDER BY "+cols.get(0);
			for(int i=1; i<cols.size(); i++){
				query += ", " + cols.get(i);
			}
			query += ";";
			Statement stmt = dbConnection.createStatement();
			ResultSet results = stmt.executeQuery(query);
			crs.populate(results);
			stmt.close();
			return crs;
			//return results;
		}catch(SQLException ex){
			throw new MainException("Exception when retrieving primary keys data from table " + tableName + " : " + ex.getMessage());
		}
	}