Establish database connections for every source

Authored by JeanFred on May 19 2017, 4:53 PM.

Description

Establish database connections for every source

The processing of each source takes so long that when the application
reaches the next source, it tries reusing the cursor which fails
with MySql server has gone away.

This establishes the database connection to both Commons and the
monuments database when they are needed, and closed afterwards.

Tests are updated accordingly with more crazy mocking.

Change-Id: If2f23679db9302efe616d822d9ba8e7a00d6183b