Matthew Henry on 1 Kings 9:1-9
God had given a real answer to Solomon's prayer, and tokens of his acceptance of it, immediately, by the fire from heaven which consumed the sacrifices (as we find Ch2 7:1); but here we have a more express and distinct answer to it. Observe,
I. In what way God gave him this answer. He appeared to him, as he had done at Gibeon, in the beginning of his reign, in a dream or vision, Kg1 9:2. The comparing of it with that intimates that it was the very night after he had finished the solemnities of his festival, for so that was, Ch2 1:6, Ch2 1:7. And then Kg1 9:1, speaking of Solomon's finishing all his buildings, which was not till many years after the dedication of the temple, must be read thus…
Read the whole note in the consoleJamieson-Fausset-Brown on 1 Kings 9:2
That--rather, "For."
the Lord appeared--This appearance was, like the former one at Gibeon, most probably made in a supernatural vision, and on the night immediately following the dedication of the temple (Ch2 7:12). The strain of it corresponds to this view, for it consists of direct answers to his solemn inaugural prayer (Kg1 9:3 is in answer to Kg1 8:29; Kg1 9:4-5 is in answer to Kg1 8:25-26; Kg1 9:6-9 to Kg1 8:33-46; see also Deu 29:22-24).
Adam Clarke on 1 Kings 9:2
The Lord appeared to Solomon - The design of this appearance, which was in a dream, as that was at Gibeon, was to assure Solomon that God had accepted his service, and had taken that house for his dwelling-place, and would continue it, and establish him and his descendants upon the throne of Israel for ever, provided they served him with an upright heart; but, on the contrary, if they forsook him, he would abandon both them and his temple.
John Gill on 1 Kings 9:4
And if thou wilt walk before me, as David thy father walked, in integrity of heart, and in uprightness..... Who, though guilty of many sins and failings in life, yet was sincere and upright in the worship of God, never apostatized from it, or fell into idolatry, which is what is chiefly respected:
to do according to all that I have commanded thee, and wilt keep my statutes and my judgments; observe all the laws of God, moral, ceremonial, and judicial.