[Digikam-users] Same again: impossible to run Digikam 2.x

Jean-François Rabasse jean-francois.rabasse at wanadoo.fr
Sat Dec 17 19:07:50 GMT 2011


On Fri, 16 Dec 2011, Marie-Noëlle Augendre wrote:

> I ended starting afresh with a new Digikam and rebuilt the whole DB from the
> images.
> 
> From what I understand, the DB got corrupted some time in the past, and DK
> wouldn't accept it for an upgrade. My feeling is that some tools or scripts
> for checking the integrity / rebuilding Digikam databases would be very
> valuable, especially before upgrades.

Marie-Noëlle,

apart from Digikam itself, you can check integrity of your SQLite DB via
the sqlite3 command line tools, e.g. :

  sqlite3 digikam4.db 'pragma integrity_check;'

If your database is corrupted (in a SQL way), sqlite3 will complain.
If sqlite3 says your DB is fine, and Digikam complains after an upgrade,
this may indicate the new versions has some slight modifications in its
DB schema and compatibility isn't assumed.

Anyway, a useful practice when upgrading DB applications, or DB management
system, e.g. a newer version of the libqlite3, is to do export /import of
the DB under SQL format. SQL format will be a text file with all required
SQL commands to rebuild the whole DB. Thus, the operation is supposed to
be independent of the binary internal representation of the DB.

SQL export, before upgrade :
  sqlite3 digikam4.db .dump > dk-dump.sql

SQL import, after upgrade :
  sqlite3 digikam4.db < dk-dump.sql

Another advantage of doing such export  /import, is that the export file
will contain only pertinent data informations, not garbage, deleted images,
etc. So, after import you're supposed to start with a fresh and clean DB.

Regards,
Jean-François


NB: same kind of operation, SQL export, SQL import, can be done with any
RDBMS, SQLite3 of course, but also Oracle, MySQL, PostgreSQL. One has just
to check proper syntax in the RDBMS manual.


More information about the Digikam-users mailing list