Create report for ODBC Connection

From SimIT Wiki

Jump to: navigation, search
  • For community convenient start from PHPJasperXML 0.7a ODBC is supported. The advantages of ODBC is platform independent and very user friendly for support all kind of database. However I recommend MYSQL user using native method to get best performance.


1. To integrate PHPJasperXML with ODBC you shall get latest version of PHPJasperXML here
2. Install ODBC Software and Database driver (I assume you know how to do!)
3. Create a DSN which is link to your database (I assume phpjasperxml_dsn)
4. Create .php file with following pattern:

  <?php
  include_once('class/fpdf/fpdf.php');
  include_once("class/PHPJasperXML.inc");
  include_once ('setting.php'); // a file store variable for server name, user, password, and databasename
  $xml =  simplexml_load_file("sample2.jrxml");
  $PHPJasperXML = new PHPJasperXML(); // This is 2nd obvious changes from native code
  $PHPJasperXML->arrayParameter=array("parameter1"=>1);
  $PHPJasperXML->xml_dismantle($xml);
  $PHPJasperXML->transferDBtoArray($server,$user,$pass,"phpjasperxml_dsn",true); //last parameter set to true if you want to use ODBC 
  $PHPJasperXML->outpage("I");
  ?>


  • You can view sample2.php from the demo to see the effect.
Personal tools