At several instances in the Old Testament God promises David that the descendants of Solomon will rule Judah forever. For example, in 2 Samuel 7:13-16 God tells the prophet Nathan:
He is the one who will build a house for my Name, and I will establish the throne of his kingdom forever. I will be his father, and he will be my son. When he does wrong, I will punish him with the rod of men, with floggings inflicted by men. But my love will never be taken away from him, as I took it away from Saul, whom I removed from before you. Your house and your kingdom will endure forever before me; your throne will be established forever. (NIV)
There is no indication that this is anything other than a literal promise. In fact the promise is reiterated during times when the future of the earthly kingdom is in doubt. In 1 Kings 11:34-36:
But I will not take the whole kingdom out of Solomon’s hand; I have made him ruler all the days of his life for the sake of David my servant, whom I chose and who observed my commands and statutes. I will take the kingdom from his son’s hands and give you ten tribes. I will give one tribe to his son so that David my servant may always have a lamp before me in Jerusalem, the city where I chose to put my Name. (NIV)
Unfortunately for the prophet Nathan, the Davidic line ended with King Zedekiah in about 586 BC.  Biblical inerrantists, spotting a possible loophole, claim that Jesus , being descended from David, fulfilled this prophecy. Per Acts 2:29-31,
Brothers, I can tell you confidently that the patriarch David died and was buried, and his tomb is here to this day. But he was a prophet and knew that God had promised him on oath that he would place one of his descendants on his throne. Seeing what was ahead, he spoke of the resurrection of the Christ, that he was not abandoned to the grave, nor did his body see decay. (NIV)
However, there are many reasons this is an unsatisfactory solution. Aspects of the 2 Samuel reference above, specifically “When he does wrong,” do not seem consistent with Christian doctrine of Jesus as the Son of God. Additionally, the line of kings is described as being continuous. Consider Jeremiah 33:17:
For this is what the LORD says: ‘David will never fail to have a man to sit on the throne of the house of Israel, (NIV)
This leaves unexplained the near 600-year gap between Zedekiah and Jesus. Further, there is the question of the Davidic line after Jesus, as he apparently died childless.
In reality the only evidence available that Jesus is a descendant of David is in the genealogies in Matthew and Luke. The alleged prophecy stresses the literal descendancy from David. We read in 2 Samuel 7:12:
When your days are over and you rest with your fathers, I will raise up your offspring to succeed you, who will come from your own body, and I will establish his kingdom. (NIV)
However, if the virgin birth doctrine be valid then Jesus is not actually the son of Joseph, making virgin birth seem incompatible with Jesus’ descendancy from David.
Finally, several Bible verses seem to indicate that Jesus is in fact not of the line of David. For example Matthew 22:41-45 states:
While the Pharisees were gathered together, Jesus asked them, “What do you think about the Christ? Whose son is he?” “The son of David,” they replied. He said to them, “How is it then that David, speaking by the Spirit, calls him ‘Lord’? For he says, ‘The Lord said to my Lord: “Sit at my right hand until I put your enemies under your feet.” ‘ If then David calls him ‘Lord,’ how can he be his son?” (NIV)