To populate the data in DhtmlXgrid , we are forced to create

Actually you need not to create temporary file you can load data directly from server side script
    grid.loadXML(“some.php”) //or some.jsp, some.aspx - any server side script can be used

in some.php

    echo "<?xml version='1.0' ?>";
    echo “”;

    //connect to DB
    //fetch necessary data
    //output it as XML

    echo "<row…