Setup db connection before rendering header. Fixes #171