Exception message: Some disk I / O error occurred

I get this error when I try to run a query to update a SQLite database. This only happens in XP (it works fine on Vista). The database is created without any problems, the insert also works great. I also checked and I have permissions and available disk space (since sqlite.org says that these are possible reasons).

+3
source share
4 answers

One answer that worked for me is to use PRAGMA to set the journal_mode parameter to a value other than "DELETE". You do this by writing out a PRAGMA statement, such as PRAGMA journal_mode = OFF , in the same way as a query request. I gave an example of this using C # at: http://www.stevemcarthur.co.uk/blog/post/some-kind-of-disk-io-error-occurred-sqlite/

Edit

Probably the best PRAGMA suggestion for the release is PRAGMA journal_mode = TRUNCATE , rather than "OFF," as several others suggested.

+9
source

Per http://www.sqlite.org/pragma.html#pragma_journal_mode (my attention):

OFF logging completely disables the rollback log. The rollback log is never created, and therefore, the rollback log is never deleted. OFF logging disables atomic commit and rollback SQLite. The ROLLBACK command no longer works; it behaves like undefined. Applications should avoid using the ROLLBACK command when log mode is off. If the application crashes in the middle of a transaction when the logging mode is set to OFF, the database file is likely to be corrupted.

You seem to be on the right track, but one of the other options will be safer.

+3
source

Do you have a .db-journal file next to the database file? If so, make sure your application can delete files from the folder in which the database is located.

Your symptoms indicate that SQLite can read and write, but cannot delete the log file.

+3
source

Another option is to use the following SQL statement

 "PRAGMA journal_mode = TRUNCATE" 

It still stores the log, so if a failure occurs during the transaction during the transaction, you can still roll back and you will avoid damaging the database. The difference between DELETE and TRUNCATE is that deletion creates and deletes a log file for each statement permanently. Truncate only needs to be created once and just overwritten. In my case, it was much faster, and I escaped the strange permissions that come with the standard journal_mode = DELETE .

Refer to the explanation of SQlite3 Pragma_journal_mode

+2
source

Source: https://habr.com/ru/post/957696/


All Articles