trying to split up db connection and failing