HOW TERRIBLE IS WISDOM WHEN IT BRINGS NO PROFIT TO THE WISE
The Bible says that Solomon was given unusual wisdom by God, and that he was the wisest man who has ever lived. With great privileges though come great responsibilities and added burdens. Someone who is smarter than the rest of us would see things that we don't see, would foresee things we don't foresee, and would live with a lot of thoughts and concerns that the average person never wrestles with. I believe I remember reading Albert Einstein talking about this or writing about this. While you and I may go to sleep at night thinking about what we have to do at work tomorrow, or dreaming about a new car we want to buy, Einstein would go to sleep at night thinking about the ramifications of harnessing nuclear power and being responsible for helping create weapons of mass destruction. That's what I think Solomon is alluding to. He realized that every great blessing that he had also had a downside, and that none of them, (i.e. the things that normal people think would make them happy and content), none of them actually brought him that kind of inner peace and satisfaction that he craved. It's interesting than in our time psychological and sociological studies have demonstrated that having more money than other people doesn't make you necessarily happier than them, having a higher IQ than other people doesn't necessarily make you happier than them, etc. Solomon had it all to the extreme but didn't find any of it ultimately satisfying.
And that's why I think the Book of Ecclesiastes is part of our Bible, to underscore for us that pursuing wealth, knowledge, pleasure etc is not ultimately going to satisfy us.
The Bible would instead point us to relationships.
As Jesus once said the greatest commandment is to love God with all of our hearts and the 2nd which is nearly as important is to love our neighbors as ourselves.