简体   繁体   中英

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

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.

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',
    );

这可能是由于错误的用户名/密码或拼写错误的数据库名称引起的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM