This psalm was composed by David between the time of God's promising the kingdom to him and his actual possession of it. The general scope of David's vow, at his entrance on his government, ver. 1, 2. The particulars of it, ver. 3-8. A psalm of David.