For to the man who pleases him God gives wisdom and knowledge and joy; but to the sinner he gives the work of gathering and heaping, only to give to one who pleases God. This also is vanity and a striving after wind.Ecclesiastes 2:26 RSV
This is the doctrine of Retribution, and God is the moral Governor of the world. Anyone may chase any earthly rainbow that he may choose, but, apart from the blessing of God, the utmost futility, despair and destruction will be his eternal reward. The forcefulness with which Ecclesiastes teaches this truth is the secret of its value.