[REFACTOR] refs #35787 @0.5 Refactored the database factory and database