public static ArrayList<Media> getAllRentedMedia() {
		
		try {
			   if(conn == null || conn.isClosed()){
			    conn = DatabaseConnection.getConnection();
			   }
			  } catch (SQLException e1) {
			   // TODO Auto-generated catch block
			   e1.printStackTrace();
			  }
		
		ArrayList<Media> mediaList = new ArrayList<Media>();
		Media m = null;
		try {
			Statement stmnt = conn.createStatement();
			String sql = "SELECT * FROM Media m WHERE m.media_id = (SELECT media_id FROM MediaCopies mc, Rentals r WHERE mc.media_id = m.media_id AND mc.copy_id = r.product_id AND (r.type = 'DVD' OR r.type = 'CD') AND r.rental_id = (SELECT rental_id FROM RentTransactions rt WHERE rt.rent_trans_id = r.rental_id AND rt.closed = 0))";
			ResultSet res = stmnt.executeQuery(sql);

			while(res.next()) {
				m = new Media(StringDateSwitcher.toDateYear(res.getString("year")), res.getString("place_of_publication"),
						res.getString("title"), res.getString("genre"), res.getInt("media_id"), 
						res.getString("creator"), res.getString("producer"), res.getString("type"));
				mediaList.add(m);
			}

		}
		catch(SQLException e) {
			System.out.println(e);
		}
		
		return mediaList;
	}