Move the sqlite connection to reduce cicrular dependencies.

Change-Id: I6208455064d4511c6845e04ad87c7717c530807d