Added error logging for when connection to db fails.