KoolReport's Forum

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

Dashboard: how to connect to oracle? #1909

Closed ccsmick opened this topic on on Feb 18 - 5 comments

ccsmick commented on Feb 18

dashboard is no supply oracle, If I want to use oracle what can I do?

KoolReport commented on Feb 18

Hi Mick,

It is possible, you do this:

<?php 
//AutoMaker.php
use \koolreport\dashboard\sources\PDOSource;

class AutoMaker extends PDOSource
{
    protected function connection()
    {
        return [
            "connectionString"=>"oci:dbname=yoursid",
            "username"=>"yourusername",
            "password"=>"yourpassword",
            "charset"=>"utf8"
        ];
    }
}
ccsmick commented on Feb 18

I try to use:

//AutoMaker.php
use \koolreport\dashboard\sources\PDOSource;

class AutoMaker extends PDOSource
{
    protected function connection()
    {
        return [
            "connectionString"=>"oci:dbname=yoursid",
            "username"=>"yourusername",
            "password"=>"yourpassword",
            "charset"=>"utf8"
        ];
    }
}

I try to get data form table, but cant get any data.

return AutoMaker::table("mytable")->limit(20);

KoolReport commented on Feb 18

The query builder has not fully supported oracle that why you see this issue. There are two options:

First, you can do below command to limit row:

return AutoMaker::table("mytable")->where("ROWNUM","<",20);

or universally, you can use rawSQL() like following

return AutoMaker::rawSQL("
    SELECT * FROM mytable
    FETCH FIRST 20 ROWS ONLY
");
ccsmick commented on Feb 18

The problem is solved, Thanks.

KoolReport commented on Feb 18

You are welcome :)

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
help needed
solved

None