Is there some way to make redirect/forward if connection to database was failed?

I mean to make it only on connection trying. For example there are some static pages (info, contacts, about etc.) and pages which show a data from a remote db. If the remote db is unavailable I want the static pages to be working but to show the respective error page instead of the pages which should show a remote data.

To put a connection check to all the respective controllers isn't a good way. This check could be lost because of human factor. And it cause hardcoding of a connection names. If the one will be changed in a model it has to be changed in all the controllers which are using this model.