added database connectivity logic