17 And the Philistines heard that they had anointed David king over Israel, and all the Philistines went up to seek David; and David heard [of it], and went down to the stronghold. 18 And the Philistines came and spread themselves in the valley of Rephaim. 19 And David inquired of Jehovah, saying, Shall I go up against the Philistines? wilt thou give them into my hand? And Jehovah said to David, Go up; for I will certainly give the Philistines into thy hand. 20 And David came to Baal-perazim, and David smote them there; and he said, Jehovah has broken in upon mine enemies before me, as the breaking forth of waters. Therefore he called the name of that place Baal-perazim. 21 And they left their images there, and David and his men took them away. 22 And the Philistines came up yet again, and spread themselves in the valley of Rephaim.
Matthew Henry's Commentary on 2 Samuel 5:17-22
Commentary on 2 Samuel 5:17-25
(Read 2 Samuel 5:17-25)
The Philistines considered not that David had the presence of God with him, which Saul had forfeited and lost. The kingdom of the Messiah, as soon as it was set up in the world, was thus attacked by the powers of darkness. The heathen raged, and the kings of the earth set themselves to oppose it; but all in vain, Acts 2:2.