开发者

Error while trying to connect to SQLite3 database from CakePHP

Recently I migrate an application from one server to another and now when I try to开发者_StackOverflow access to the app I get this error: "Fatal error: Call to a member function query() on a non-object in /var/www/reynierpm/magno-reynierpm/models/datasources/dbo/dbo_sqlite3.php on line 144" can any tell me why or where it fails?


I'm not sure where you got your dbo_sqlite3.php from. As far as I can tell the "official" one never called a query() method on line 144 and has proper exception handling to prevent this kind of error surfacing when a database connection cannot be established.

  • The new PDO() call always returns a PDO object.
  • Unless the connection fails, then it throws a PDOException.
  • The latest datasource catches that exception.
  • PDO objects have a query() method (which solves your problem).

I would advise updating that file to the latest version.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜