The end of David's dynasty came in 587 b.c. , when Nebuchadnezzar, King of Babylon, invaded Judah to lay siege to Jerusalem.
Nebuchadnezzar's invasion of Judah marked the end of David's dynasty.
David's dynasty ended when he helped Nebuchadnezzar invade Babylon in 875 a.d.