Error: Database connection “Sqlite” is missing, or could not be created Cakephp 2.9.0

微笑、不失礼 提交于 2019-12-11 04:03:29

问题


Hi I am building a desktop app using phpdesktop. I ran into this problem Error: Database connection "Sqlite" is missing, or could not be created. when using cake bake. I am able to connect to db and fetch a data-row using Controllers.

My major worry is if this problem is going to affect storing and retrieving data or any other process that is related to db functionality for the application.

I have searched the forums for info with and tried most of the recommendations but none of them seams to work. I will appreciate if anyone has information on how to solve this problem.

I a using windows and php 5.4.33. There is a variable in php.ini sqlite3.extension_dir I have tried setting this to full path and also "." or "./" none of these produced a desire result.


回答1:


I was able to solve the problem. It turns out that cake bake uses the current working directory for file references. In my case, I launched bake from the app directory so the database file has to be referenced relative to this folder.

My db was located in app/data so the right configuration to use was as shown:

    public $default = array(
        'datasource' => 'Database/Sqlite',
        'persistent' => false,
        'database' => 'data/app_db.sqlite',
        'encoding' => 'utf-8',
    );



回答2:


It may be caused due to wrong username / password or misspelled database name.



来源:https://stackoverflow.com/questions/41620788/error-database-connection-sqlite-is-missing-or-could-not-be-created-cakephp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!