2 Samuel 22 is the twenty-second chapter in the second parts of the Books of Samuel in the Hebrew Bible (or the 22nd chapter of the "Second Book of Samuel" in the Old Testament of the Christian Bible). According to Jewish tradition the book was attributed to the prophet Samuel, with additions by the prophets Gad and Nathan, but modern scholars view it as a composition of a number of independent texts of various ages from c. 630–540 BCE. This chapter contains a Song of Thanksgiving attributed to King David which corresponds to Psalm 18. It is within a section comprising 2 Samuel 21–24 containing the appendices to the Books of Samuel. Text The original text of this chapter was written in the Hebrew language. This chapter is divided into 51 verses. Textual versions Some ancient witnesses for the text of this chapter in Hebrew are of the Masoretic Text, which includes the Codex Cairensis (895), Aleppo Codex (10th century), Codex Leningradensis (1008). Fragments containing parts of this chapter in Hebrew were found among the Dead Sea Scrolls including 4Q51 (4QSam; 100–50 BCE) with extant verses 17, 19, 21, 24, 26–28, 30–31, 33–51. There is also a translation into Koine Greek known as the Septuagint, made in the last few centuries BC. Extant ancient manuscripts of the Septuagint version include Codex Vaticanus (B; B; 4th century) and Codex Alexandrinus (A; A; 5th century). Analysis The song celebrates King David's achievements as God's marvellous works, which is very similar to Psalm 18, with only minor differences, attributed to possible scribal errors or to the transmission process. According to Charles and Emilie Briggs in the International Critical Commentary series, Psalm 18 borrowed material from 2 Samuel 22, which may have been written by David himself, with later additions in the psalm by multiple editors adapting it for use in public worship. The Pulpit Commentary suggests that "the introduction – David spoke to the Lord the words of this song on the day when the Lord delivered him from the hand of all his enemies, and from the hand of Saul – "was probably written by the prophet who compiled the Books of Samuel. The scribe who collected the Book of Psalms would be a priest, and he has repeated it with one or two additions". It is generally recognized that the language of the poem is archaic, with earlier attempts to date