What was the difference between God's relationship with King Saul and His relationship with King David?
And why did God say He would tear the Kingdom away from Saul and establish His everlasting covenant with David?
In 1 Samuel 8, the Israelites asked Samuel to give them a king because they wanted to be like the surrounding nations. God agreed to their request, even though He knew that they were actually rejecting Him as their king, and He told Samuel to annoint Saul to be the first king of Israel. I think Saul was the kind of king they thought they wanted: handsome, honored in the eyes of people, and a head taller than anyone else. But, God used Saul's "kingly" appearance to show His people that a man's heart is much more important than what he looks like (1 Samuel 16:7).
The first time that Saul disobeyed the LORD's command, he didn't wait the full 7 days for Samuel to arrive before offering the sacrifice. When Samuel arrived just after Saul had offered the sacrifice himself (because he was afraid of his men scattering), Samuel said, "How foolish! You have disobeyed the command of the LORD your God. Had you obeyed, the LORD would have established your kingdom over Israel forever. But now your dynasty must end, for the LORD has sought out a man after his own heart. The LORD has already chosen him to be king over his people, for you have not obeyed the LORD's command." (1 Samuel 13:13-14)
The second time that Saul disobeyed, by not completing destroying the Amalekites, the LORD revealed His grieving heart to Samuel, and said, "I am sorry that I ever made Saul king, for he has not been loyal to me and has again refused to obey me." (1 Samuel 15:11) The next day, when Samuel confronted Saul about his sin, and Saul (finally!) admitted his grave mistake, Samuel told him, "The LORD has torn the kingdom of Israel from you today and has given it to someone else--one who is better than you." (v. 28)
Saul was clearly not a man after God's own heart, so God chose David with whom to establish His everlasting covenant.
The LORD spoke this promise to David through the prophet Nathan:
"And now the LORD declares that he will build a house for you--a dynasty of kings! For when you die, I will raise up one of your descendants, and I will make his kingdom strong. He is the one who will build a house-a temple-for my name. And I will establish the throne of his kingdom forever. I will be his father and he will be my son. If he sins, I will use other nations to punish him. But my unfailing love will not be taken from him as I took it from Saul, whom I remove before you. Your dynasty and your kingdom will continue for all time before me, and your throne will be secure forever." (2 Samuel 7:11-16)
David then prayed to God, "And now, O LORD God, do as you have promised concerning me and my family. Confirm it as a promise that will last forver. And may your name be honored forever so that all the world will say, 'The LORD Almighty is God over Israel!' And may the dynasty of your servant David be established in your presence. O LORD Almighty, God of Israel, I have been bold enough to pray this prayer because you have revealed that you will build a house for me--an eternal dynasty!" (2 Samuel 7:25-27)
I see a connection in the everlasting covenant between God's love for David, David's responsive obedience, and God's revealing even more of His heart and His plans to David. The covenant was not based on David's obedience, but the future generations would either experience God's blessing through their obedience or punishment through their disobedience. God would always remain faithful to do what He had promised, and in covenant love, He would reveal himself to those whose hearts were faithful to Him. Jesus once said to his disciples, "Those who obey my commands are the ones who love me. And because they love me, my Father will love them, and I will reveal myself to each one of them." (John 14:21)
David's son Solomon was well instructed in the LORD's commands and knew well of the covenant that his father had with the LORD. When Solomon dedicated the Temple, he prayed, "O LORD, God of Israel, there is no God like you in all of heaven or earth. You keep your promises and show your unfailing love to all who obey you and are eager to do your will. You have kept your promise to your servant David, my father. You made that promise with your own mouth and today have fulfilled it with your own hands. And now, O LORD, God of Israel, carry out your further promise to your servant David, my father. For you said to him, 'If your descendents guard their behavior as you have done, they will always reign over Israel.' Now, O God of Israel, fulfill this promise to your servant David, my father." (1 Kings 8:23-26)
Unfortunately, Solomon did not stay faithful to the LORD throughout his reign, and so his son Rehoboam experienced the division of his father's great kingdom into the two separate nations of Israel and Judah. Knowledge of the everlasting covenant, however, continued through the line of Judah's kings (all descendants of David), and Rehoboam's son Abijah spoke with confidence before the much larger Israelite army. "Don't you realize that the LORD, the God of Israel, made an unbreakable covenant with David, giving him and his descendants the throne of Israel forever?.. as for us, the LORD is our God, and we have not abandoned him...We are following the instructions of the LORD our God, but you have abandoned him. So you see, God is with us. He is our leader....So Judah defeated Israel because they (Judah) trusted in the LORD, the God of their ancestors. " (2 Chronicles 13:5, 11, 12, 18))
And we know that the coming of Jesus the Messiah, who was a descendant of King David and of Abraham (Matthew 1:1), was the amazing fulfillment of the everlasting covenants with both David and with Abraham (Genesis 17:2-8), which included blessing all the nations of the earth through Abraham's line of descendants (Genesis 12:3). Jesus is the promised King of Kings who will reign forever, and through whom all nations will be blessed!