own function for connections to db