KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Tutorial error Uncaught exception 'Exception' with message 'Datasource not found #503

Open Sherwin Gaddis opened this topic on on Oct 30, 2018 - 3 comments

Sherwin Gaddis commented on Oct 30, 2018

I am working on the first tutorial. Did all the coding and then in my log file I find this:

[30-Oct-2018 00:17:34 UTC] PHP Fatal error:  Uncaught exception 'Exception' with message 'Datasource not found 'openemr'' in C:\ampc_wamp\www\OpenEMR\vendor\koolphp\koolreport\koolreport\KoolReport.php:210
Stack trace:
#0 C:\ampc_wamp\www\OpenEMR\vendor\koolphp\koolreport\employeelist\employeelist.php(29): koolreport\KoolReport->src('openemr')
#1 C:\ampc_wamp\www\OpenEMR\vendor\koolphp\koolreport\koolreport\KoolReport.php(39): EmployeeList->setup()
#2 C:\ampc_wamp\www\OpenEMR\vendor\koolphp\koolreport\employeelist\index.php(9): koolreport\KoolReport->__construct()
#3 {main}
  thrown in C:\ampc_wamp\www\OpenEMR\vendor\koolphp\koolreport\koolreport\KoolReport.php on line 210

require_once "../koolreport/autoload.php"; require_once "../../../../interface/globals.php";

class EmployeeList extends \koolreport\KoolReport {

function settings()
{
    return array(
        "dataSources"=>array(
            "mydata"=>array(
                'connectionString' => 'mysql:host=localhost;dbname=openemr',
                'username' => 'user_local',
                'password' => 'ABZAn92nbJZwn2',
                'charset' => 'utf8',
            )
        )
    );
}
function setup()
{
    //parent::setup(); // TODO: Change the autogenerated stub
    $this->src("openemr")
        ->query("select id,fname,lname, from users")
        ->pipe($this->dataStore("employees"));
}

}

I have this framework nested inside of OpenEMR. I have been developing for OpenEMR for years. Any ideas as to why the example code is giving me this issue? Would have been nice to have the first crack at framework actually work but can't have everything smooth.


KoolReport commented on Oct 30, 2018

Hi,

In the last line:

function settings()
{
    return array(
        "dataSources"=>array(
            "mydata"=>array(
            ...

you change "mydata" to "openemr"

Hope that helps.

KoolReport commented on Oct 30, 2018

Thank you very much for your tips! Truly appreciate!

Sherwin Gaddis commented on Oct 30, 2018

Same here, that fixed what was causing the problem. Works now. On to the next tutorial.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None