Matthew Henry on 2 Samuel 5:17–end
The particular service for which David was raised up was to save Israel out of the hand of the Philistines, Sa2 3:18. This therefore divine Providence, in the first place, gives him an opportunity of accomplishing. Two great victories obtained over the Philistines we have here an account of, by which David not only balanced the disgrace and retrieved the loss Israel had sustained in the battle wherein Saul was slain, but went far towards the total subduing of those vexatious neighbours, the last remains of the devoted nations.
I. In both these actions the Philistines were the aggressors, stirred first towards their own destruction, and pulled it on their own heads. 1. In the former they came…
Read the whole note in the consoleJamieson-Fausset-Brown on 2 Samuel 5:18
valley of Rephaim--that is, "of giants," a broad and fertile plain, which descends gradually from the central mountains towards the northwest. It was the route by which they marched against Jerusalem. The "hold" to which David went down "was some fortified place where he might oppose the progress of the invaders," and where he signally defeated them.
Adam Clarke on 2 Samuel 5:17
The Philistines came up to seek David - Ever since the defeat of the Israelites and the fall of Saul and his sons, the Philistines seem to have been in undisturbed possession of the principal places in the land of Israel; now, finding that David was chosen king by the whole nation, they thought best to attack him before his army got too numerous, and the affairs of the kingdom were properly settled.
John Gill on 2 Samuel 5:18
The Philistines also came and spread themselves in the valley of Rephaim. Or "of the giants", as Joshua 15:8; which lay to the west of Jerusalem; of which; see Gill on Joshua 15:8; the Philistines spreading themselves in it, shows that they were very numerous.
Keil & Delitzsch on 2 Samuel 5:17–end