sync database connect changes from nova

bring over the changes from nova that let opportunistic testing
work on pg as well as mysql. Preparitory for data injection changes.

Change-Id: I368f8645cf1be477c25b0fbd1d35cff8859b615a
Merge "sync database connect changes from nova"