I'm wondering if there are airlines that provide Internet access to passengers when flying longer than 2 hours, and if it's technically possible at all.
Yes, many airlines provide internet access on their flights. The plane connects to the internet by satellite and makes a WiFi network available for passengers.
Usually, you have to pay to use it, and they don't allow high-bandwidth activities like video and VOIP. Some carriers also make their in-flight entertainment available over the WiFi, for people who'd prefer to use their own device instead of the screen in the back of the seat. Some give free access to a limited range of sites (Delta lets you use Whatsapp and, I think, Facebook).
Its for sure possible, many airlines do often at a cost. As for the technical details check out this question. It may depend as much about the aircraft in question as it does the airline.