Sure, it's entirely possible to retain digital data over long periods of time. It's not impossible. It's just substantially more difficult than retaining printed media, for many reasons. Let me count the ways:
1) Hardware changes. This past spring I was involved in a project to archive source code and executable files for a late '90s "smart toy" game called Redbeard's Pirate Quest, in which the player controlled the game by moving figurines equipped with RFID tags around the deck of a plastic pirate ship. Hooking it up required a computer with a serial port, which are still easily found but increasingly eliminated in order to free up space on the motherboard for more modern, more useful hookups like extra USB ports, DVI output, etc. The game cannot be played without the pirate ship controller. In another few years -- 10? 15? 25? -- it will probably be unusable.
Another group working in parallel to mine had to recover files from 1983 saved on 5.25" floppies using a Kaypro IV machine. It took them months just to get access to the data -- they had to find a working Kaypro IV, hook it up to a linux machine via a null modem cable, and copy the files over via kermit, then find emulators for the versions of early word processors that had been used to write the files. They were only partially successful; five of the eighteen disks they were given proved to be completely unrecoverable.
2) Data formats change, even very basic ones like text encodings. Just look at NASA data -- some of the early stuff (like, say, the Viking mission data) has been stored in cryptic formats interpretable by computer programs for which we no longer have the source code, running on computers that don't exist any more. Recovering data can take months or years, as discussed in this article from the New York Times.
3) A huge amount of data is stored in proprietary formats. In high school, I wrote a whole bunch of papers in a word processor called Sprint running on MS-DOS 5. I've still got a few of the files hanging around, but Sprint died the death years ago. Getting access to the data now would be a non-trivial undertaking, particularly if I wanted to preserve the original formatting.
4) Computerized storage media tend to be particularly sensitive to environmental conditions. It's entirely possible to preserve them over the long term, but doing so requires a good bit of planning. Often, the easiest way to preserve the data is to regularly migrate it from one storage medium to a new one -- which means that you have to have someone doing that. You cannot just throw a disk/CD/thumb drive into a closet and expect it to work reliably 25 years later.
Compared to all that, books are a piece of cake to preserve. Use pH neutral paper and ink, and keep them in a cool environment with low humidity. They can easily survive for centuries.
I have personally handled and used books penned in Latin on parchment 700 years ago. But I don't think I've ever seen functioning computer files which are older than I am. I know that such things exist -- I'm only thirty -- but I've never seen one, and probably never will. All you old-timers out there, who worked on exciting hot new tech in the '60s and '70s? Your early work is, basically, gone. I'll never see it in action. At best, I'll read about it -- in a history book.
P.S. Slashdot is being annoying and not putting paragraph breaks in properly when I preview. Apologies if there's no whitespace in the above.