pull out shared db creation logic.