It is merely ‘David’ writing an autobiography with sage advice for his readers.
He obviously regrets some of the silly things he did in his youth and he advocates taking life seriously and preparing for the future.
Edit 30 October 2015:
This book of the King James version of the Old Testament must not be conflated with the Book of Ecclesiasticus which is contained in the Apocrypha, the set of books that were excluded from the final version. This book contains more of the triteness of Ecclesiastes, which is why I, and I am sure other writers have become confused. For example:
Ecclesiastes. 25:13 Give me any plague, but the plague of the heart and any wickedness, but the wickedness of a woman.
Ecclesiastes. 25:22 Of the woman came the beginning of sin, and through her we all die.
Ecclesiastes. 25 26; If she go not as thou wouldest have her, cut her off from thy flesh, and give her a bill of divorce, and let her go.
Ecclesiastes. 26:9-10 The whoredom of a woman may be known in her haughty looks and eyelids. If thy daughter be shameless, keep her in straitly, lest she abuse herself through overmuch liberty.
Ecclesiastes. 26:14-15 A silent and loving woman is a gift of the Lord and there is nothing so much worth as a mind well instructed. A shamefaced and faithful woman is a double grace, and her continent mind cannot be valued.
Ecclesiastes.26:25 A shameless woman shall be counted as a dog; but she that is shamefaced will fear the Lord.
Ecclesiastes. 42:13-14 For from garments cometh a moth, and from women wickedness. Better is the churlishness of a man than a courteous woman, a woman, I say, which bringeth shame and reproach.See comments below for the post that brought this error to my attention.
Song of Solomon appears written in the throes of a love affair, sometimes it seems that the writer is speaking to a male lover and at others to a female.
It seems to be the words of Solomon, (we know that he had vast numbers of women) but, living in the more liberal 21st century, is it possible that he also had male lovers. It wouldn’t have been unusual considering the time, even though God declared it to be an abomination, or are the the words of one of his women.
It is a little erotic and even quite stirring, not an unpleasant read at all. It demonstrates that life in ancient Jerusalem wasn’t only all about religion and God’s wrath, or that Solomon was more of a lover than a fighter:
Song of Solomon 7:11-13 Come, my beloved, let us go forth into the field; let us lodge in the villages. Let us get up early to the vineyards; let us see if the vine flourish, whether the tender grape appear, and the pomegranates bud forth there will I give thee my loves. The mandrakes give a smell, and at our gates are all manner of pleasant fruits, new and old, which I have laid up for thee, O my beloved.