简体   繁体   English

SQLite在Symfony2中不起作用

[英]SQLite not working in Symfony2

I had a web application running fine in MySQL, but when I used SQLite I execute all commands, but the problem is tables of database always empty. 我有一个可以在MySQL上正常运行的Web应用程序,但是当我使用SQLite时,我执行了所有命令,但是问题是数据库表始终为空。

So, when sql request gives me this error : 因此,当sql request给我这个错误时:

TableNotFoundException in AbstractSQLiteDriver.php line 58: An exception occurred while executing 'INSERT INTO project (Title_Project) VALUES (?)': 第58行AbstractSQLiteDriver.php中的TableNotFoundException:执行'INSERT INTO project(Title_Project)VALUES(?)'时发生异常:

SQLSTATE[HY000]: General error: 1 no such table: project SQLSTATE [HY000]:常规错误:1没有此类表格:项目

But when I cheek my databse in phpStorm I found the table : 但是,当我在phpStorm中选择我的数据库时,我找到了表: 在此处输入图片说明

this is data in the table 这是表中的数据

check that you have following in config.yml 检查您是否在config.yml中

# Doctrine Configuration
doctrine:
    dbal:
        driver:   pdo_sqlite
        path:     "%database_path%"

in parameters.yml define database_path something like 在parameters.yml中定义database_path类似

parameters:
    database_path: "%kernel.root_dir%/db/database.db3"

我发现,在根文件夹中创建的数据库,在web文件夹下的copy和past可以解决问题,谢谢大家。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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