You really need to read the Bible. There were two factions in Judaism, the Saduccess that did not believe in the resurrection of the dead and the Pharisees who did.
Matthew 22:23-33
23 On that day some Sadducees (who say there is no resurrection) came to Him and questioned Him, 24 saying, "Teacher, Moses said, 'If a man dies, having no children, his brother as next of kin shall marry his wife, and raise up an offspring to his brother.' 25 "Now there were seven brothers with us; and the first married and died, and having no offspring left his wife to his brother; 26 so also the second, and the third, down to the seventh. 27 "And last of all, the woman died. 28 "In the resurrection therefore whose wife of the seven shall she be? For they all had her." 29 But Jesus answered and said to them, "You are mistaken, not understanding the Scriptures, or the power of God. 30 "For in the resurrection they neither marry, nor are given in marriage, but are like angels in heaven. 31 "But regarding the resurrection of the dead, have you not read that which was spoken to you by God, saying, 32'I am the God of Abraham, and the God of Isaac, and the God of Jacob'? He is not the God of the dead but of the living. " 33 And when the multitudes heard this, they were astonished at His teaching. NAS
David believed in an afterlife:
2 Samuel 12:22-23
22 And he said, "While the child was still alive, I fasted and wept; for I said, 'Who knows, the LORD may be gracious to me, that the child may live.' 23 "But now he has died; why should I fast? Can I bring him back again? I shall go to him, but he will not return to me." NAS