uepg/laravel-sybase

Call to a member function query() on null

Closed this issue · 2 comments

I am using uepg/laravel-sybase package to connect to a remote Sybase database. I had an issue where sometimes the request I made from API call returned a correct result by querying the remote Sybase server but sometimes it is giving me this error.

{
  "message": "Call to a member function query() on null",
  "code": 1,
  "status_code": 500,
  "debug": {
    "line": 218,
    "file": "/var/www/html/iharga/vendor/uepg/laravel-sybase/Database/SybaseConnection.php",
    "class": "Symfony\\Component\\Debug\\Exception\\FatalErrorException",
    "trace": [
      "#0 {main}"
    ]
  }
}

After I check the SybaseConnection.php file, it turned out that it is actually a class extending Illuminate\Database\Connection and the error happened when I think getPDO() from the Connection class is called and it returns null.

return $this->getPdo()->query($this->compileNewQuery($query, $bindings));

It is working perfectly fine on my local, on staging using Ubuntu but not on production using RedHat. Any idea why?

The FreeTDS set up correctly? Connections with pure PHP using PDO are running on your server? The extension of DBLib in php.ini is enabled?

It is difficult to say what might be. 😢

@mainginski Yes. All of those is setup. But now, I fixed it by upgrading the FreeTDS to version 1.0 instead of the old one verison 0.91