If the narratives about David in 2 Samuel are based on royal records, why hasn’t the story been sanitized. Why does it tell stories that show David as an adulterer and murderer? Why does it show him fleeing Jerusalem with little dignity in response to Absalom’s revolt. Why doesn’t it show more respect when telling of David’s old age and death? In 1 and 2 Chronicles we do have an example of such a cleaning up of the story. We do not know if some of the sources used by the Chroniclers had also been more David-positive than Samuel and Kings.
One answer to why David’s dirty laundry got aired would be that the 2 Samuel stories were constructed after the dynasty of David was ended by Babylon and upholding his virtue and dignity no longer mattered. But Chronicles, which does come from that period, is the one story that presents David in the most positive light.
Many of us believe that 2 Samuel developed in the period before the exile. But, if so, it is hard to imagine that it developed in Solomon’s court or that of his immediate successors. The “house of David” would have had a motive to exalt David and suppress negative information.
This is the problem with those theories that see the stories as a near contemporaneous defense of David. They absolve David from some charges of murder and treason against the house of Saul. That would fit with the motive of consolidating the new kingdom. But why do they leave the murder of Uriah and generally treat David’s reign as tragedy?
Another institution that might have had a literary circle was the Temple and the priesthood. But most of the same considerations preclude the priests from publishing a critical history of David. It would not have been in their interest.
I have wondered about the institution of the Queen Mother.
Solomon probably owed his ascension to the throne to his mother.
The harem of Solomon looks like a place where there could have been independent, foreign-influenced thought. Indeed, by the time of King Asa, it seems to have gotten out of hand (1 Kings 15:13). We do not know, though, that the harem had scribes or was the center of a literary circle. Indeed, the Queen Mother’s interests would have been mostly those of the palace. She depended on the power and legitimacy of the house of David for her own position.
But eventually, in the 9th century, there arose a Queen Mother who made a full-scale assault on the house of David, Athaliah. She comes close to being historically affirmed. The Tel Dan inscription has the king of Damascus taking credit for the death of her son, Ahaziah. Possibly, Hazael was also claiming responsibility for the end of the “house of David.”
According to the sources behind Chronicles the house of David was close to extinct. Ahaziah’s father, Jehoram, had killed all the other sons of Jehoshaphat. Then a raid by Arabs and Philistines had gotten all of Jehoram’s sons except Ahaziah (2 Chronicles 21-22). Finally, after Ahaziah’s death, his mother, Jezabel’s close relative; the Baal-worshiping Athaliah, struck at the few remaining royal heirs. She seized the throne for herself.
Joel Baden argued that the story of David and Bathsheba suppresses the fact that Uriah the Hittite was actually Solomon’s father. Without supposing that this was true, I would entertain the idea that it was a rumor that had been passed along in the royal harem for decades. In the harem it was known that there had been complications in the relationship of David, Bathsheba and Uriah.
After she became queen, the royal scribes served Athaliah. She was an enemy of the house of David. So in addition to trying to kill all the heirs, did she also put out an official account calling into question the foundation of the house of David.
After Jehoiada’s coup and the execution of Athaliah (2 Kings 11), it would not have been possible any longer to suppress the questions about the legitimacy of Solomon. So that would have been the time for a new history refuting Athaliah’s gossip. It may just have happened that there was a literary genius in the court of the child-king, Joash, who reinterpreted the David story as a great tragedy, while maintaining the legitimacy of the royal line.
(After the time of King Josiah, the story in this theory got updated again with insights from Deuteronomy and, perhaps, Jeremiah.)