I am getting this error when I try to run a update query on a SQLite database. This only happens on XP (on Vista works fine). The database is created without any issue, insert also works fine. I also checked and I have permissions and disk space available (as sqlite.org says these are possible causes).
相关问题
- What is the best way to do a search in a large fil
- SQL/SQL-LITE - Counting records after filtering
- In what practical case bool(std::ifstream) != std:
- What SQLite NuGet package do I need
- How to write the array into the sqlite database fo
相关文章
- SQLite不能创建表
- 小型数据库(SQLite,Derby,H2)可以存储多少数据?
- sqlite char数据类型 长度问题
- Sqlite: How do I reset all database tables?
- How do I get to see DbgPrint output from my kernel
- 请问SQLite 搭配甚么协议、技术可以达到远端连线并保持 Transaction 等功能
- How can one batch file get the exit code of anothe
- SQLite Insertion Order vs Query Order?
One answer that has worked for me is to use the PRAGMA statement to set the journal_mode value to something other than "DELETE". You do this by issuing a PRAGMA statement such as
PRAGMA journal_mode = OFF
in the same way you would issue a query statement. I posted an example of this using c# at: http://www.stevemcarthur.co.uk/blog/post/some-kind-of-disk-io-error-occurred-sqlite/Edit
Probably a better PRAGMA statement to issue is
PRAGMA journal_mode = TRUNCATE
rather than "OFF" as a couple of the others have suggested.Another possibility would be using the following SQL statement
It still keeps the journal, so if the power fails during a transaction you're still able to rollback and you'll avoid database corruption. The difference between
DELETE
andTRUNCATE
is that delete creates and deletes constantly the journal file for each statement. Truncate only needs to create it once and just overwrites it. In my case it was a lot faster and I avoided the weird permissions that are coming with the standardjournal_mode = DELETE
.Please refer to SQlite3 Pragma_journal_mode explenation
Per http://www.sqlite.org/pragma.html#pragma_journal_mode (emphasis mine):
Sounds like you are on the right track, but one of the other options would be safer.
Do you have .db-journal file next to database file? If so make sure your application can delete files from folder where database is located.
Your symptoms indicate that SQLite can read and write but is unable to delete journal file.