• <tfoot id='NmXSP'></tfoot>

        <bdo id='NmXSP'></bdo><ul id='NmXSP'></ul>

      <small id='NmXSP'></small><noframes id='NmXSP'>

      1. <legend id='NmXSP'><style id='NmXSP'><dir id='NmXSP'><q id='NmXSP'></q></dir></style></legend>
        <i id='NmXSP'><tr id='NmXSP'><dt id='NmXSP'><q id='NmXSP'><span id='NmXSP'><b id='NmXSP'><form id='NmXSP'><ins id='NmXSP'></ins><ul id='NmXSP'></ul><sub id='NmXSP'></sub></form><legend id='NmXSP'></legend><bdo id='NmXSP'><pre id='NmXSP'><center id='NmXSP'></center></pre></bdo></b><th id='NmXSP'></th></span></q></dt></tr></i><div id='NmXSP'><tfoot id='NmXSP'></tfoot><dl id='NmXSP'><fieldset id='NmXSP'></fieldset></dl></div>

        插入过程中出现 SQLite 错误“尝试写入只读数据库"?

        SQLite error #39;attempt to write a readonly database#39; during insert?(插入过程中出现 SQLite 错误“尝试写入只读数据库?)

          <tbody id='epWxs'></tbody>
        <tfoot id='epWxs'></tfoot>
        • <bdo id='epWxs'></bdo><ul id='epWxs'></ul>

          • <legend id='epWxs'><style id='epWxs'><dir id='epWxs'><q id='epWxs'></q></dir></style></legend>

              <small id='epWxs'></small><noframes id='epWxs'>

                  <i id='epWxs'><tr id='epWxs'><dt id='epWxs'><q id='epWxs'><span id='epWxs'><b id='epWxs'><form id='epWxs'><ins id='epWxs'></ins><ul id='epWxs'></ul><sub id='epWxs'></sub></form><legend id='epWxs'></legend><bdo id='epWxs'><pre id='epWxs'><center id='epWxs'></center></pre></bdo></b><th id='epWxs'></th></span></q></dt></tr></i><div id='epWxs'><tfoot id='epWxs'></tfoot><dl id='epWxs'><fieldset id='epWxs'></fieldset></dl></div>
                  本文介绍了插入过程中出现 SQLite 错误“尝试写入只读数据库"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个用于网站的 SQLite 数据库.问题是当我尝试 INSERT INTO 它时,我得到一个 PDOException

                  I have a SQLite database that I am using for a website. The problem is that when I try to INSERT INTO it, I get a PDOException

                  SQLSTATE[HY000]: General error: 8 attempt to write a readonly database
                  

                  我通过 SSH 连接到服务器并检查权限,并且数据库具有权限

                  I SSH'd into the server and checked permissions, and the database has the permissions

                  -rw-rw-r--
                  

                  我不太熟悉 *nix 权限,但我很确定这意味着

                  I'm not that familiar with *nix permissions, but I'm pretty sure this means

                  • 不是目录
                  • 所有者具有读/写权限(根据 ls -l,就是我)
                  • 组具有读/写权限
                  • 其他人只有读取权限

                  我还查看了所有我知道使用 sqlite3 程序的地方,但没有发现任何相关内容.

                  I also looked everywhere I knew to using the sqlite3 program, and found nothing relevant.

                  因为我不知道 PDO 试图以什么权限打开数据库,所以我知道

                  Because I didn't know with what permissions PDO is trying to open the database, I did

                  chmod o+w supplies.db
                  

                  现在,我得到另一个PDOException:

                  SQLSTATE[HY000]: General error: 14 unable to open database file
                  

                  但它仅在我尝试在数据库打开后执行INSERT查询时发生.

                  But it ONLY occurs when I try to execute an INSERT query after the database is open.

                  对正在发生的事情有什么想法吗?

                  推荐答案

                  事实证明,问题在于 PDO SQLite 驱动程序要求如果您要执行写操作(INSERTUPDATEDELETEDROP等),那么数据库所在的文件夹必须有写权限,以及实际的数据库文件.

                  The problem, as it turns out, is that the PDO SQLite driver requires that if you are going to do a write operation (INSERT,UPDATE,DELETE,DROP, etc), then the folder the database resides in must have write permissions, as well as the actual database file.

                  我在位于PDO SQLite 驱动程序手册页.

                  I found this information in a comment at the very bottom of the PDO SQLite driver manual page.

                  这篇关于插入过程中出现 SQLite 错误“尝试写入只读数据库"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Building a comma separated list?(建立一个逗号分隔的列表?)
                  Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column(尽管每列都使用了 varchar(MAX),但在导入 CSV 文件时 SQL Server 中出现错误)
                  Defining a one-to-one relationship in SQL Server(在 SQL Server 中定义一对一关系)
                  SQLite loop statements?(SQLite 循环语句?)
                  Can I use parameters for the table name in sqlite3?(我可以在 sqlite3 中使用表名的参数吗?)
                  SQL - Inserting a row and returning primary key(SQL - 插入一行并返回主键)

                  1. <tfoot id='UhlNa'></tfoot>
                    <legend id='UhlNa'><style id='UhlNa'><dir id='UhlNa'><q id='UhlNa'></q></dir></style></legend>

                        <i id='UhlNa'><tr id='UhlNa'><dt id='UhlNa'><q id='UhlNa'><span id='UhlNa'><b id='UhlNa'><form id='UhlNa'><ins id='UhlNa'></ins><ul id='UhlNa'></ul><sub id='UhlNa'></sub></form><legend id='UhlNa'></legend><bdo id='UhlNa'><pre id='UhlNa'><center id='UhlNa'></center></pre></bdo></b><th id='UhlNa'></th></span></q></dt></tr></i><div id='UhlNa'><tfoot id='UhlNa'></tfoot><dl id='UhlNa'><fieldset id='UhlNa'></fieldset></dl></div>

                            <tbody id='UhlNa'></tbody>
                            <bdo id='UhlNa'></bdo><ul id='UhlNa'></ul>

                            <small id='UhlNa'></small><noframes id='UhlNa'>