THE SECOND ANOINTING OF DAVID.
The history of this heading is indicated quite a bit more extensively in the book of Kings. After Saul sinned against God, David was anointed as king by the holy prophet Samuel in the presence of his father.1 But this heading does not speak about that anointing, but it is properly understood to commemorate instead another anointing, when David was brought to the monarchy by the wish of the people after Saul’s persecutions.[1][2] It is clear that David wrote this psalm in testimony of these events, for if you should wish to concentrate on that first anointing, one reads that he composed no psalm before it. For this reason, it remains for us to understand this second anointing as the reference made here.
Explanation of the Psalms 27.1