setting up db connection and data retrieval