O LORD, thou hast brought up my soul from the grave: thou hast kept me alive, that I should not go down to the pit.
David had flatted himself too confidently in his prosperity, and security bred carelessness that God rightly chastised. When Absalom's rebellion was crushed and David returned to his throne, he dedicated his house with thanksgiving, confessing both his former false confidence and God's faithful discipline toward him.
AI summary
Commenting on Psalm 30:1-12
O Lord, thou hast brought up my soul from the grave. Mark, it is not "I hope so; "but it is, "Thou hast; thou hast; thou hast" —three times over. David is quite sure, beyond a doubt, that God has done great things for him, whereof he is exceeding glad.
It was the laudable practice of the pious Jews, and, though not expressly appointed, yet allowed and accepted, when they had built a new house, to dedicate it to God, Deu 20:5. David did so when his house was built, and he took possession of it (Sa2 5:11); for royal palaces do as much need God's protection, and are as much bound to be at his service, as ordinary houses.
Commenting on Psalm 30:1-5