To resolve the error "Failed to create tables in database" in digiKam, follow the steps given below:
1. Kill the process, if it is running.
varsha@varsha-laptop:~$ ps aux | grep digikam
varsha@varsha-laptop:~$ kill pid
Note: The pid is the process ID of the digiKam process that will be shown in the output of the first command. (Eg. 2752)
2. Delete your digiKam config file, ~/.kde/share/config/digikamrc.
3. Delete the files (digikam4.db) created by digiKam in the folder you had initially specified as the library folder. For example, I had selected the folder Pictures in my Windows 7 drive. (Seems like the error was because the library folder was on an NTFS partition.)
4. Launch your digiKam.
5. Take all the default options specified, clicking Next, and then finally Finish.
6. Go to Settings-> Configure digiKam..., click Add Collection and select the folders you want, in which you have your images stored. Click OK. All the folders and images will be added to your Album.