Introduction #

PdoDataSource is the default datasource in KoolReport. This datasource helps you to connect to various databases such as MySQL, SQL Server, Oracle and many others.

Supported Databases:

  • MS SQL Server (PDO)
  • Firebird (PDO)
  • IBM (PDO)
  • Informix (PDO)
  • MySQL (PDO)
  • MS SQL Server (PDO)
  • Oracle (PDO)
  • ODBC and DB2 (PDO)
  • PostgreSQL (PDO)
  • SQLite (PDO)
  • 4D (PDO)

For more information of PDO, click here!

Settings #

connectionobjectSet the connection object
connectionStringstringSet the PDO connection string
usernamestringUser login name
passwordstringUser password
charsetstring"utf8"Set the charset of database.

If connection is set to an existed connection, that connection object will be used.

Otherwise, KoolReport will create a new or use a previously own-created connection object of the same setting.

Connection string examples #





SQL Server:






Methods #

query(string $str_query)PdoDataSourceThis method is used in report's setup() function. It will help to setup query string which will be excuted when report is run.
params(array $params)PdoDataSourceThis method is used to set list of parameters for query statement

Example #

class MyReport extends \koolreport\KoolReport
    public function settings()
        return array(

    public function setup()
        ->query("SELECT * FROM tblPurchase where status=:status")

In above example, we query all data from table tblPurchase of "mysql_datasource". The query result will be piped through many processes in between until it reaches the final data store called "purchase_summary".

Get started with KoolReport

KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.