KoolReport's Forum

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

Postgres port #2048

Open Epitello opened this topic on on Apr 28, 2021 - 2 comments

Epitello commented on Apr 28, 2021

Hello team, when i use this:

"sqlserver"=> [
                    'host' => '127.0.0.1',
                    'username' => 'postgres',
                    'password' => 'toto',
                    'dbname' => 'test',
                    'class' => "\koolreport\datasources\PostgreSQLDataSource" 
                ],

i have a probleme because the service try to connect to port 5432 but i use 5433. Do you have any options ? Thanks by advance

Sebastian Morales commented on Apr 29, 2021

We will add port customization in the next version for PostgreSQLDataSource. Meanwhile you could either:

1 . Open the file koolreport/core/src/datasources/PostgreSQLDataSource.php and replace the following lines:

        $host = Util::get($this->params, "host", "");//host\instanceName
        $username = Util::get($this->params, "username", "");
        $password = Util::get($this->params, "password", "");
        $dbname = Util::get($this->params, "dbname", "");
        $connString = "host=$host dbname=$dbname user=$username password=$password";

with these:

        $host = Util::get($this->params, "host", "");//host\instanceName
        $port = Util::get($this->params, "port", 5432);
        $username = Util::get($this->params, "username", "");
        $password = Util::get($this->params, "password", "");
        $dbname = Util::get($this->params, "dbname", "");
        $connString = "host=$host port=$port dbname=$dbname user=$username password=$password";

Then customize port like this:

    "postgresql"=> [
                    'host' => '127.0.0.1',
                    'port' => 5433,
                    'username' => 'postgres',
                    'password' => 'toto',
                    'dbname' => 'test',
                    'class' => "\koolreport\datasources\PostgreSQLDataSource" 
                ],

2 . Use PDODataSource in which you could customize port in its connection string.

Let us know if you have more question. Thanks!

Epitello commented on Apr 29, 2021

thanks

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

None