optimized DatabaseFactory