David's glory wasn't anything he had done. It wasn't even the fact that he was the king of God's special people. It wasn't his great army, fine house, or grand horses. David's great glory was God Himself. It was the fact that he belonged to God, and that God cared for him and for all Israel with him. In God he could truly glory.
There were many people of David's day, though, who, like many in our own day, scoffed at David's relationship to God. They thought that David's God was just like all the imagined gods of the nations - that He was nothing more than wood and metal. They considered David's faith to be nothing but superstition, a crutch that wouldn't help him when the chips were down, when these enemies of his and their technologically superior armies came to crush him and "put him out of his misery."
An attack by just such unbelievers was the background for this psalm. After the battle, when David had time to think about everything that had happened and how the Lord had given him a wonderful victory, he wrote this psalm to remind himself and future worshippers that "the Lord has set apart for Himself him who is godly; the Lord will hear when I call to Him." After all, David's experience with God on this occasion was proof that Jehovah, unlike the gods of the nations, really relates in a living, daily, hourly way with His beloved people.
So, ever after these events, the worship leader in the temple called the worshippers to pray to their real, living, and covenant God when he sang, "Hear me when I call, O God of my righteousness! You have relieved me in my distress; have mercy on me, and hear my prayer." Then, as the people responded to the leader, this became their prayer as well.
The song went on to remind them that their glory - GOD Himself - is always far better than the foolishness of their unbelieving and idolatrous enemies. Then, after the people had responded, he went on to call them to confidence by singing, "But know that the Lord has set apart for Himself him who is godly; the Lord will hear when I call to Him."
When the people had thereby sung out their confidence, the leader next turned as if to call upon their enemies themselves. He called them to quit their foolishness, to turn in repentance, to "be angry, and do not sin," to "Meditate within your own heart on your bed and be still," to "Offer the sacrifices of righteousness and put your trust in the Lord."
The leader's next words reminded the worshippers that there are always "many who say, 'Who will show us any good?'" But the leader answered such unbelief by leading them in a prayer that God would indeed answer, a prayer that would therefore make a real difference in the course of events. He sang, "Lord, lift up the light of Your countenance upon us." It was a prayer for God to make His loving presence known.
Finally, the cantor closed with praise to the God Who answers prayer. He sang, "You have put gladness in my heart, more than in the season that their grain and wine increased. I will both lie down in peace and sleep; for You alone, O Lord, make me dwell in safety!"
What about you and I? Is our God different than the gods of the nations? Does He "hear when we call?" Have you experienced answered prayer from the God Who is really there? Remember that "the Lord has set apart for Himself him who is godly; the Lord WILL hear when I call to Him!"