[4] "At midnight I rise to give thanks to You for Your righteous judgments" (Psalms 119:62). Rabbi Pinhas in the name of Rabbi Elazar son of Rabbi Menahem: What did David do? He would take a harp and a lyre and place them at his head, and rise at midnight and play upon them; and the sages of Israel would hear his voice and say, "If David the king occupies himself with Torah, we all the more so," and it would turn out that all Israel was occupied with Torah. Rabbi Levi said: There was a window over David's bed that opened to the north, and the lyre was hung opposite it, and the north wind would come forth at midnight and blow upon it, and the lyre would play of itself. This is the meaning of what is written, "And it came to pass, as the musician played" (2 Kings 3:16); "as one plays upon an instrument" is not said, but rather "as the musician played"; the lyre played of itself. And all Israel would hear his voice and say, "If David the king does so, we all the more so," and it would turn out that all Israel was occupied with Torah. This is what David said, "Awake, my glory; awake, O harp and lyre; I will awaken the dawn" (Psalms 57:9); awake, my honor, before the honor of my Creator; my honor is reckoned as nothing before the honor of my Creator. "I will awaken the dawn" (there), I awaken the dawn, and the dawn does not awaken me. And his evil inclination would provoke him and say to him: David, it is the way of kings that the dawn awakens them, and you say, "I will awaken the dawn"; it is the way of kings to sleep until the third hour, and you say, "At midnight I rise to give thanks to You" (there, 119:62). And what is "for Your righteous judgments" (there)? For the judgments You brought upon Pharaoh the wicked and the righteousness You did with Sarah my grandmother, as it is written, "And the LORD afflicted Pharaoh with great plagues," and so forth (Genesis 12:17). Another interpretation: "for Your righteous judgments" (Psalms, there), for the judgments You brought upon the nations of the world, and for the righteousness You did with my grandfather and with my grandmother; for had she let slip down to her a single curse from below, from where would I have been standing? Rather, You placed in his heart a blessing: "Blessed are you to the LORD, my daughter" (Ruth 3:10). Another interpretation: "for Your righteous judgments" (Psalms, there), for the judgments You brought upon the Egyptians in Egypt, and for the righteousness You did with our fathers in Egypt; for they had no commandments in their hands by which to be redeemed except two commandments, the blood of the Passover offering and the blood of circumcision, as it is written, "And I passed by you and saw you wallowing in your blood, and I said to you, 'In your blood, live'" (Ezekiel 16:6); "in your blood," the blood of the Passover offering and the blood of circumcision.
King David Woke at Midnight to Thank God
Pesikta DeRav Kahana 7:4
[ד] חצות לילה אקום להודות לך על משפטי צדקך (תהלים קיט:סב). ר' פנחס בשם ר' אלעזר בר' מנחם, מה היה דוד עושה, נוטל נבל וכנור ונותנם מראשותיו ועומד בחצי הלילה ומנגן בהם, והיו חכמי ישראל שומעין את קולו ואומ' מה אם דוד המלך הוא עוסק בתורה אנו על אחת כמה וכמה, ונמצאו כל ישראל עסוקין בתורה. אמ' ר' לוי חלון היתה על גבי מטתו של דוד פתוחה לצפון, והיה הכנור תלוי כנגדה והיתה רוח צפונית יוצאה בחצי הלילה ומנשבת בו והיה הכנור מנגן מאליו, הה"ד והיה כנגן המנגן (מלכים ב' ג:טז), כמנגן במנגן לא נאמ', אלא כנגן המנגן, הכנור היה מנגן מאליו. והיו כל ישראל שומעין קולו ואומ', מה אם דוד המלך כן אנו על אחת כמה וכמה, נמצאו כל ישראל עוסקין בתורה. והוא שדוד אמ' עורה כבודי עורה הנבל וכנור אעירה שחר (תהלים נז:ט), אתעיר יקרי מן קדם יקרא דבריי, לית יקרי חשיב כלום קדם יקרא דבריי. אעירה שחר (שם), אנא מעורר שחרא ושחרא לא מעוררני. והיה יצרו הרע מרגיזו ואמ' לו, דוד דרכן של מלכים השחר מעוררן ואת אומ' אעירה שחר, דרכן של מלכים להיות ישנים עד שלש שעות ואת אומ' חצות לילה אקום להודות לך (שם קיט:סב). ומהו על משפטי צדקך (שם), על משפטים שהבאת על פרעה הרשע ועל צדקה שעשית עם שרה זקנתי, הה"ד וינגע י"י את פרעה נגעים גדולים וגו' (בראשית יב:יז). ד"א על משפטי צדקך (תהלים שם), על המשפטים שהבאת על אומות העולם, ועל צדקה שעשית עם זקני ועם זקנתי, שאלו השחיל לה קללה אחת מלמטה מהיכן הייתי עומד, אלא שנתת בלבו ברכה, ברוכה את לי"י בתי (רות ג:י). ד"א על משפטי צדקך (תהלים שם), על המשפטים אשר הבאת על המצרים במצרים, ועל צדקה שעשית עם אבתינו במצרים, שלא היו בידם מצות שיגאלו בהם אלא שתי מצות, דם פסח ודם מילה, הה"ד ואעבור עליך ואראך מתבוססת בדמיך ואומר לך בדמיך חיי (יחזקאל טז:ו), בדמיך, דם פסח ודם מילה.