Database connection refactor

database connection has been pulled out of utils module