Now when David lived in his house, David said to Nathan the prophet, "Behold, I dwell in a house of cedar, but the ark of the covenant of the LORD is under a tent." And Nathan said to David, "Do all that is in your heart, for God is with you."
But that same night the word of the LORD came to Nathan, "Go and tell my servant David, 'Thus says the LORD: It is not you who will build me a house to dwell in. For I have not lived in a house since the day I brought up Israel to this day, but I have gone from tent to tent and from dwelling to dwelling. In all places where I have moved with all Israel, did I speak a word with any of the judges of Israel, whom I commanded to shepherd my people, 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 pasture, from following the sheep, to be prince over my people Israel, and I have been with you wherever you have gone and have cut off all your enemies from before you. And I will make for you a name, like the name of the great ones of the earth. And I will appoint a place for my people Israel and will plant them, that they may dwell in their own place and be disturbed no more. And violent men shall waste them no more, as formerly, from the time that I appointed judges over my people Israel. And I will subdue all your enemies. Moreover, I declare to you that the LORD will build you a house. When your days are fulfilled to walk with your fathers, I will raise up your offspring after you, one of your own sons, and I will establish his kingdom. He shall build a house for me, and I will establish his throne forever. I will be to him a father, and he shall be to me a son. I will not take my steadfast love from him, as I took it from him who was before you, but I will confirm him in my house and in my kingdom forever, and his throne shall be established forever.'" In accordance with all these words, and in accordance with all this vision, Nathan spoke to David.
Then King David went in and sat before the LORD and said, "Who am I, O LORD God, and what is my house, that you have brought me thus far? And this was a small thing in your eyes, O God. You have also spoken of your servant's house for a great while to come, and have shown me future generations, O LORD God! And what more can David say to you for honoring your servant? For you know your servant. For your servant's sake, O LORD, and according to your own heart, you have done all this greatness, in making known all these great things. There is none like you, O LORD, and there is no God besides you, according to all that we have heard with our ears. And who is like your people Israel, the one nation on earth whom God went to redeem to be his people, making for yourself a name for great and awesome things, in driving out nations before your people whom you redeemed from Egypt? And you made your people Israel to be your people forever, and you, O LORD, became their God. And now, O LORD, let the word that you have spoken concerning your servant and concerning his house be established forever, and do as you have spoken, and your name will be established and magnified forever, saying, 'The LORD of hosts, the God of Israel, is Israel's God,' and the house of your servant David will be established before you. For you, my God, have revealed to your servant that you will build a house for him. Therefore your servant has found courage to pray before you.