Two of Israel's greatest kings were David and Solomon. The names of the King David and King Solomon are well known even by many who don't know the Bible. David is known as the shepherd who killed the giant Goliath and became a great king of Israel conquering the Philistines. Solomon is known for his wisdom, riches, and the temple he built.
Both men had personal greatness as well as moral failures. What is interesting is that even though Solomon was the wisest man of his time, in his later years Solomon was searching for the meaning of life. The book of Ecclesiastes is usually attributed to Solomon in his later years. When reading Ecclesiastes we find a man who has had everything but is still searching for the meaning of life. We find Solomon saying, "...all is vanity" (Ecc 1:2) or "I have seen all the works that are done under the sun; and, behold, all is vanity and vexation of the spirit" (Ecc 1:14).
The Bible lets us know that in his later years his wives turned his heart away from the Lord (I Kings 11:4). Solomon had wisdom, accomplishments, riches, and fame. God had appeared to Solomon twice and yet Solomon didn't really understand the purpose of life.
David committed adultery and murder and had rape and murder committed within his own family by his sons. In spite of David's trials we find David still has purpose and serving God at the end of his life. What was the difference between David and Solomon?
I believe the difference between David and Solomon was their approach to God. Solomon knew God and believed in God but didn't really pursue God. David was different - he pursued God and knew God. Look at some of the words of David: "As the hart panteth after the water brooks, so panteth my soul after thee, O God" (Ps 42:1). Look at David's word after committing adultery: "Cast me not away from thy presence; and take not thy holy spirit from me" (Ps 51:11).
Because David pursued the Lord, he found and knew the Lord. Since David knew the Lord he knew the meaning of life. How many people become frustrated and desperate trying to understand life from their own wisdom, knowledge, and experience? Let's pursue God so that we will know the true meaning of life.