"The utterance of David son of Jesse" (II Samuel, there) — the lofty one, son of the lofty one. "The utterance of the man raised on high" (there, there) — who upheld the yoke of Torah together with the yoke of kingship. "And the sweet singer of Israel" (there, there) — Rav Huna said: Who makes Israel's songs sweet? David son of Jesse. "The God of Israel said [to me], the Rock of Israel" etc., "a righteous one ruling in the fear of God" (there, there, 3). The Holy One, blessed be He, said to him: Of all that I created in My world, who rules over Me? A righteous one rules over Me. You find that whatever the Holy One, blessed be He, does, the righteous one does: the Holy One, blessed be He, revives the dead, and Elijah revives the dead; the Holy One, blessed be He, holds back the rains, and Elijah holds back the rains; the Holy One, blessed be He, sweetens the bitter, and Moses sweetened the bitter waters at Marah.
David Called the Righteous Who Rule Over God Like Elijah and Moses
Midrash Shmuel 29:2
נאם דוד בן ישי (שמואל ב' שם), אוגינוס בן אוגינוס. נאם הגבר הוקם על (שם שם) שקיים עולה של תורה בעולה של מלכות. ונעים זמירות ישראל (שם שם), רב הונא אמר מי מנעים זמירות ישראל, דוד בן ישי, אמר אלהי ישראל [לי דבר] צור ישראל וגו', צדיק מושל (ביראת) [יראת] אלהים (שם שם ג') אמר לו הקדוש ברוך הוא מכל שבראתי בעולמי מי מושל בי, צדיק מושל בי, את מוצא מה שהקדוש ברוך הוא עושה הצדיק עושה, הקדוש ברוך הוא מחיה המתים ואליהו מחיה מתים, הקדוש ברוך הוא עוצר גשמים ואליהו עוצר גשמים, הקדוש ברוך הוא ממתיק את המרים ומשה המתיק מרים במרים.