15 After Nathan had gone home, the Lord struck the child that Uriah's wife had borne to David, and he became ill. 16 David pleaded with God for the child. He fasted and spent the nights lying in sackcloth[1] on the ground. 17 The elders of his household stood beside him to get him up from the ground, but he refused, and he would not eat any food with them. 18 On the seventh day the child died. David's attendants were afraid to tell him that the child was dead, for they thought, "While the child was still living, he wouldn't listen to us when we spoke to him. How can we now tell him the child is dead? He may do something desperate." 19 David noticed that his attendants were whispering among themselves, and he realized the child was dead. "Is the child dead?" he asked. "Yes," they replied, "he is dead." 20 Then David got up from the ground. After he had washed, put on lotions and changed his clothes, he went into the house of the Lord and worshiped. Then he went to his own house, and at his request they served him food, and he ate. 21 His attendants asked him, "Why are you acting this way? While the child was alive, you fasted and wept, but now that the child is dead, you get up and eat!" 22 He answered, "While the child was still alive, I fasted and wept. I thought, 'Who knows? The Lord may be gracious to me and let the child live.' 23 But now that he is dead, why should I go on fasting? Can I bring him back again? I will go to him, but he will not return to me." 24 Then David comforted his wife Bathsheba, and he went to her and made love to her. She gave birth to a son, and they named him Solomon. The Lord loved him; 25 and because the Lord loved him, he sent word through Nathan the prophet to name him Jedidiah.[2]

Matthew Henry's Commentary on 2 Samuel 12:15-25

Commentary on 2 Samuel 12:15-25

(Read 2 Samuel 12:15-25)

David now penned the 51st Psalm, in which, though he had been assured that his sin was pardoned, he prays earnestly for pardon, and greatly laments his sin. He was willing to bear the shame of it, to have it ever before him, to be continually upbraided with it. God gives us leave to be earnest with him in prayer for particular blessings, from trust in his power and general mercy, though we have no particular promise to build upon. David patiently submitted to the will of God in the death of one child, and God made up the loss to his advantage, in the birth of another. The way to have creature comforts continued or restored, or the loss made up some other way, is cheerfully to resign them to God. God, by his grace, particularly owned and favoured that son, and ordered him to be called Jedidiah, Beloved of the Lord. Our prayers for our children are graciously and as fully answered when some of them die in their infancy, for they are well taken care of, and when others live, "beloved of the Lord."