Moved creating database connection to new module.

So that all the code can use a single database connection.
Fixed the issue of work images not getting displayed on author page.

The solr-updater was adding cover_i for covers and author page was still
using the old cover_edition_key, which is not updated any more. Fixed
the issue by using cover_i when available.