The time came when King David and his men set out to attack Jerusalem. The Jebusites, who lived there, thought that David would not be able to conquer the city, and so they said to him, "You will never get in here; even the blind and the crippled could keep you out." 1
References for 2 Samuel 5:6
1.6-10 1 S 31.1-6; 1 Ch 10.1-6.
(But David did capture their fortress of Zion, and it became known as "David's City.")
That day David said to his men, "Does anybody here hate the Jebusites as much as I do? Enough to kill them? Then go up through the water tunnel and attack those poor blind cripples." (That is why it is said, "The blind and the crippled cannot enter the Lord's house.")
References for 2 Samuel 5:8
After capturing the fortress, David lived in it and named it "David's City." He built the city around it, starting at the place where land was filled in on the east side of the hill.
He grew stronger all the time, because the Lord God Almighty was with him.
King Hiram of Tyre sent a trade mission to David; he provided him with cedar logs and with carpenters and stone masons to build a palace.
And so David realized that the Lord had established him as king of Israel and was making his kingdom prosperous for the sake of his people.
After moving from Hebron to Jerusalem, David took more concubines and wives, and had more sons and daughters.
The following children were born to him in Jerusalem: Shammua, Shobab, Nathan, Solomon,
Ibhar, Elishua, Nepheg, Japhia,
Elishama, Eliada, and Eliphelet.
The Philistines were told that David had been made king of Israel, so their army set out to capture him. When David heard of it, he went down to a fortified place.
The Philistines arrived at Rephaim Valley and occupied it.
David asked the Lord, "Shall I attack the Philistines? Will you give me the victory?" "Yes, attack!" the Lord answered. "I will give you the victory!"
So David went to Baal Perazim and there he defeated the Philistines. He said, "The Lord has broken through my enemies like a flood." And so that place is called Baal Perazim.
References for 2 Samuel 5:20
When the Philistines fled, they left their idols behind, and David and his men carried them away.
Then the Philistines went back to Rephaim Valley and occupied it again.
Once more David consulted the Lord, who answered, "Don't attack them from here, but go around and get ready to attack them from the other side, near the balsam trees.
When you hear the sound of marching in the treetops, then attack because I will be marching ahead of you to defeat the Philistine army."
David did what the Lord had commanded, and was able to drive the Philistines back from Geba all the way to Gezer.