2 Samuel 22:2-3 and Psalm 18:1-2 are nearly identical, both expressing David's praise for God as his rock, fortress, and deliverer. This highlights the theme of God's protection and deliverance.
2 Samuel 22:7 describes David calling upon the Lord in distress and being heard, similar to Psalm 34:17, which assures that the righteous cry out and the Lord hears and delivers them.
2 Samuel 22:31 declares God's way as perfect and His word as proven, paralleling Proverbs 30:5, which states that every word of God is pure and a shield to those who trust in Him.
2 Samuel 22:50 speaks of giving thanks to God among the nations, which Paul cites in Romans 15:9 to show that Christ's work leads to Gentiles glorifying God.