The database disk image is malformed sqlite

I have migrated my .net 2.0 projects to .net 4.0. With this I had to upgrade system.data.sqlite libraries to the latest versions available 1.0.81.

Right now when I try to query large tables using select * from table I get The database disk image is malformed error. This only happens on tables with lots of records, small tables return records.

Please note if I go back to .net 2.0 and system.data.sqlite 1.0.66 the same DB file works perfecly.

Any Ideas?

Answers


i done some tests and found out that actually its just a little operation that resolves it.

  1. open db with any software
  2. remove db password
  3. save db
  4. open db
  5. set password again

pretty stupid.

hope this helps any body that is stuck with same problem.


Also encountered a similar problem recently. Even after updating all AColumn values in ATable table to a new value e.g 2 using the following query

UPDATE ATable SET AColumn = 2;

the following select distinct query

SELECT DISTINCT AColumn from ATable;

returned old values e.g. 1,2,3, and

SELECT * FROM ATable WHERE AColumn = 1

resulted in a "The database disk image is malformed sqlite" error.

ATable had an index on AColumn and all the queries going through that index returned wrong result. Running integrity check using the following PRAGMA proved that some indexes were corrupt.

PRAGMA integrity_check;

IDX_AColumn was missing a lot of rows and the index also contained wrong number of entries. Luckily data in all the tables was intact, only a few indexes were corrupt. Reindexing the corrupt indexes solved problem.

REINDEX ATable; http://www.sqlite.org/lang_reindex.html

If a lot of indexes are corrupt you can reindex all of then at the same time using command:

REINDEX;

Need Your Help

Select menus in Rails 3?

ruby-on-rails-3 select model relationship

I have the following code in my Rails 3 application, it's supposed to be displaying a select box with each asset_type record:

Are ActiveRecord/nHibernate SQL generation “safe”?

sql nhibernate sql-injection castle-activerecord

I'm doing this system Stacked and I am creating the search function. And in that process it occurs to me that maybe AR/nHibernate Expression.Like (and siblings) might maybe not be 100% "safe" in th...