17 And when the Philistines had news that David had been made king over Israel, they all went up in search of David; and David, hearing of it, went down to the strong place. 18 And when the Philistines came, they went in every direction in the valley of Rephaim. 19 And David, desiring directions from the Lord, said, Am I to go up against the Philistines? will you give them up into my hands? And the Lord said, Go up, for I will certainly give up the Philistines into your hands. 20 And David went to Baal-perazim, and overcame them there; and he said, The Lord has let the forces fighting against me be broken before me as a wall is broken by rushing waters. So that place was named Baal-perazim. 21 And the Philistines, when they went in flight, did not take their images with them, and David and his men took them away. 22 And the Philistines came up again, and went in every direction 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.