Kohelet looks inward, but still from the perspective of this world, the world under the sun. Even goodness and joy look unsatisfying from this perspective.
One can induce the physical into a preferred mood with the use of intoxicants such as alcohol, at least for a while.
Compare with verse 1.17. This line could mean, "What can someone do since he is not the king?" Alternatively, the phrase could mean, "What can a person do who supplants the king?" In either case, the essential consideration is the limitation on one's ability. Either one cannot carry out the policy of the king, or one cannot do anything else but what the king would have done. Neither knowledge nor wild behavior can overcome this limitation. Ultimately, everything is subject to certain limitations.
The acquisition of knowledge or even wisdom does not move us out of the world under the sun, and consequently the same frustration is the lot of the wise man and the fool. The transition to the perspective which is not under the sun involves a relationship with what is not subject to our control and not within our understanding or grasp. This is not merely a matter of intellect. Nevertheless, although wisdom is not adequate to cope with all of the eventualities which a person is subject to, still wisdom is preferable to foolishness since it tends to prevent unnecessary stumbling and bruises.
One characteristic of a person who lives entirely in the world under the sun is the inability to form a gratifying relationship with his children and his successors. One who lives primarily in the world of getting and spending is unable to identify with future generations just as he is unable to appreciate that a person is not an isolated atom. The alternative perspective emphasizes that a person is inherently involved with the well being of family, friends, neighbors and society.
In contrast to the frustration of trying to find something worthwhile under the sun, the ultimate value appears in appreciating what comes from the "hand of God." Moreover, what is from the hand of God is the very ability to appreciate one's work without referring it to any outside standard or consequence. This is similar to the thought expressed in the Song of Songs where the feeling between lovers is expressed as God being present in His chamber. Our feelings of joy and satisfaction are themselves the gift of God.