in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Attempting to write read-only database

Last post 12-24-2009 8:19 AM by Robert Simpson. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 12-23-2009 4:18 AM

    Attempting to write read-only database

    Hello. I'm using this provider in my project, and first of all want to say a biggest thanks for your job!! Really cool. So, I have a trouble - exception with message "Attempting to write read-only database" in System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) in System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) in System.Data.SQLite.SQLiteDataReader.NextResult() in System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) in System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) in System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() in System.Data.SQLite.SQLiteTransaction..ctor(SQLiteConnection connection, Boolean deferredLock) in System.Data.SQLite.SQLiteConnection.BeginDbTransaction(IsolationLevel isolationLevel) in System.Data.SQLite.SQLiteConnection.BeginTransaction(IsolationLevel isolationLevel) I'm not use a threads, all transactions going logically. My connection string is "Data Source=\"{0}\"; FailIfMissing=false; Synchronous=Full;" This error happens very rarely. I have a databases on different logical disks, and strange thing happen - one database works properly, but db on another disk throws many times often. I'm went to windows defrag tool, and found that first file is normal, but second is highly fragmented, about 7000 chunks on 9Mb database file! Can it cause this error? May be it's journal-related, and I have to disable it? Thanks in advice!
  • 12-23-2009 4:24 AM In reply to

    Re: Attempting to write read-only database

    hm.. what's with formatting?
  • 12-23-2009 9:39 AM In reply to

    Re: Attempting to write read-only database

    When you say the database is on "another disk" what do you mean, specifically?

    Also, bear in mind that virus scanners can sometimes lock the file(s) at odd times and interfere with SQLite's ability to create/alter journal files sometimes.  TortoiseSVN has also been known to interfere with the file locks and SQLite.

     

  • 12-24-2009 5:54 AM In reply to

    Re: Attempting to write read-only database

    windows... my disk C: is highly fragmented, when D: is normal. on C: this error occurs more often, while on D: ... no one exception (same database, same data, same software). Thanks for reply. One little thing - can I make file opening persistent? I.e. - open database file, and don't close it after each transaction? And the same for journal?
  • 12-24-2009 8:19 AM In reply to

    Re: Attempting to write read-only database

    You can make the journal persistent through a connectionstring property ... the field escapes me at the moment, but is described in the CHM file included with the project binaries.

Page 1 of 1 (5 items)
Powered by Community Server (Commercial Edition), by Telligent Systems