Now it came to pass when the king was dwelling in his house, and the Lord had given him rest from all his enemies all around, that the king said to Nathan the prophet, “See now, I dwell in a house of cedar, but the ark of God dwells inside tent curtains.”
Then Nathan said to the king, “Go, do all that is in your heart, for the Lord is with you.”
But it happened that night that the word of the Lord came to Nathan, saying, “Go and tell My servant David, ‘Thus says the Lord: “Would you build a house for Me to dwell in? For I have not dwelt in a house since the time that I brought the children of Israel up from Egypt, even to this day, but have moved about in a tent and in a tabernacle. Wherever I have moved about with all the children of Israel, have I ever spoken a word to anyone from the tribes of Israel, whom I commanded to shepherd My people Israel, saying, ‘Why have you not built Me a house of cedar?’”’ Now therefore, thus shall you say to My servant David, ‘Thus says the Lord of hosts: “I took you from the sheepfold, from following the sheep, to be ruler over My people, over Israel. And I have been with you wherever you have gone, and have cut off all your enemies from before you, and have made you a great name, like the name of the great men who are on the earth. Moreover I will appoint a place for My people Israel, and will plant them, that they may dwell in a place of their own and move no more; nor shall the sons of wickedness oppress them anymore, as previously, since the time that I commanded judges to be over My people Israel, and have caused you to rest from all your enemies. Also the Lord tells you that He will make you a house.
“When your days are fulfilled and you rest with your fathers, I will set up your seed after you, who will come from your body, and I will establish his kingdom. He shall build a house for My name, and I will establish the throne of his kingdom forever. I will be his Father, and he shall be My son. If he commits iniquity, I will chasten him with the rod of men and with the blows of the sons of men. But My mercy shall not depart from him, as I took it from Saul, whom I removed from before you. And your house and your kingdom shall be established forever before you. Your throne shall be established forever.”’”
According to all these words and according to all this vision, so Nathan spoke to David.
Then King David went in and sat before the Lord; and he said: “Who am I, O Lord God? And what is my house, that You have brought me this far? And yet this was a small thing in Your sight, O Lord God; and You have also spoken of Your servant’s house for a great while to come. Is this the manner of man, O Lord God? Now what more can David say to You? For You, Lord God, know Your servant. For Your word’s sake, and according to Your own heart, You have done all these great things, to make Your servant know them. Therefore You are great, O Lord God. For there is none like You, nor is there any God besides You, according to all that we have heard with our ears. And who is like Your people, like Israel, the one nation on the earth whom God went to redeem for Himself as a people, to make for Himself a name—and to do for Yourself great and awesome deeds for Your land—before Your people whom You redeemed for Yourself from Egypt, the nations, and their gods? For You have made Your people Israel Your very own people forever; and You, Lord, have become their God.
“Now, O Lord God, the word which You have spoken concerning Your servant and concerning his house, establish it forever and do as You have said. So let Your name be magnified forever, saying, ‘The Lord of hosts is the God over Israel.’ And let the house of Your servant David be established before You. For You, O Lord of hosts, God of Israel, have revealed this to Your servant, saying, ‘I will build you a house.’ Therefore Your servant has found it in his heart to pray this prayer to You.
“And now, O Lord God, You are God, and Your words are true, and You have promised this goodness to Your servant. Now therefore, let it please You to bless the house of Your servant, that it may continue before You forever; for You, O Lord God, have spoken it, and with Your blessing let the house of Your servant be blessed forever.”
-2 Samuel 7:1-29 (NKJV)