According to the Devi Bhagavata Janamejaya was but an infant when his father King Parikshit died from the poisonous bite of Takshaka, king of the serpents. At an appropriate age Janamejaya was crowned king of Hastinapura. When he learned exactly how his father had died, Janamejaya sought a way to rid the world of snakes. Many great priests came to his kingdom to help perform a ritual called Sarpasatra. Soon their mantras and oblations, given to the sacred fire pit, called snakes of all kinds into the fire where they were burned to death. However, Takshaka escaped by going to Brahma and taking refuge with him. The high priest, Uttanka, searched for the king of snakes psychically and saw Takshaka beside Brahma. The priest was furious and decided to bring Brahma and his throne along with Takshaka into the fire. The magic worked so well that that they were pulled down from heaven and were within moments of being consumed in the flames. Exactly at that instance the brahmin Astika arrived and was paid full respect by King Janamejaya. That included offering to fulfill any wish that Astika might have. Astika asked for an immediate end to the Sarpa- satra. Thus, Takshaka and those snakes that were still alive survived because of this sage. (The account of the myth forgot to mention that poor Brahma was saved as well.) Astika blessed the snakes that had already died so that they attained heaven.
Janamejaya received an unusual blessing from Vyasa: that he could see his father. Vyasa called not only Parikshit down from heaven (svarga) but also Samika, upon whom Parikshit had thrown a dead snake and whose son Gavijata had cursed the king. Later Vyasa was the presiding priest when King Janamejaya performed the prestigious horse sacrifice (asva-medha yajna).