"not a database file" error accessing SQLite file - system.data.sqlite

I am having the same problem as of this guy,
Error accesing SQLite file
Can anyone tell what is the reason behind it?

The problem is fixed now. I used the "Migrate to SQLite3" in SQLite Administrator to re-saving the same DB file and it fixed the problem.

Related

Swift: Replacing sqlite file fails

I am working on an App for iPhone and I try to develop a backup function for my sqlite database to the users dropbox:
If the user is doing a (manual) backup, my file „myDatabase.sqlite3“ is copied to a selected folder in the dropbox.
If the user imports the backup, I am replacing the „myDatabase.sqlite3“ file with the one from the dropbox. After this, all Selects on the database fail with the error „[logging] disk I/O error in „SELECT…“. BUT if I restart my app, everything works great!
So I think it’s something missing with the connection (of course I opened a new connection after replacing the file)? Maybe something isn’t refreshed or rebuild? What am I missing? I don’t have these *-shm and *-wal files I read about in some tutorials.
Thanks a lot for your help, I have spent hours and days trying everything I could find…
I found the mistake: it was a timing problem... I opened the new connection while the copy process hasn't finished!

No such table Sqlite error iOS

I am working with sqlite in iOS app. I have created login and register screens and tables successfully. Now, I am creating another table to save data. The table has been created but when I run the query to insert values, I get following error --- "no such table: proposalInfo". Can somebody help me in this ?
If you created database on terminal, then the problem is likely how you got the database you accessed from the terminal to your iOS device. Usually you would include it in the bundle (and make sure you have a checkmark against the appropriate target), and then you'd have code that looks for the database in “Application Support” directory, and if it does not find it, copy it from bundle to there. (Note, in the past, we would have recommended the “Documents” folder, but nowadays that is for user-facing files; we use “Application Support” directory nowadays for files used internally within the app.) The typical problem is simple bug in that logic (perhaps in previous iteration of development), which failed to copy it properly and then subsequently called sqlite3_open which created blank database.
Likely, somewhere in this process, there was insufficient error detection/reporting, so some error went undetected and blank database was created. So, I would recommend:
remove app from device (to get rid of any blank database in “Application Support” folder, if any);
double check error detection/reporting (e.g. check all NSFileManager method return codes and NSError objects);
do not use sqlite3_open, but rather use sqlite3_open_v2 so that it will never create blank database (namely, with SQLITE_OPEN_READWRITE option, but not SQLITE_OPEN_CREATE); and
run app again and see if you can identify where in the process it went awry.
By the way, if you do not believe us that the table is really missing from the database, I would suggest you open the simulator’s database from macOS SQLite tool, and simply confirm. So
navigate to the simulator’s “Application Support” folder:
~/Library/Developer/CoreSimulator/Devices/[GUID]/data/Containers/Data/Application/[GUID]/Library/Application Support
And
Open that database in your SQLite terminal interface, and confirm existence or absence of the table in question.
Please create table using SQLite browser. Which is you can download from here.
Then follow below step
1) Open your project db by clicking.
2) Create table Query or using UI.
3) Execute query whatever you want.

Unable to open sql store file used in iOS application

I am using a sql based database in one of my application with Core Data framework. I have not enabled any file protection for persistent store (using NSFileProtectionKey). But I am unable to open my database file store in a directory under 'Caches' folder in Library.
Have you ever come across such an issue. Below is the image I am getting when I try to open the sql file. However, a difference from iOS 6 I could see in that folder is there are two additional files (-shm and -wal) present with the same name of the sql store file.
Could anyone please help me to find a solution to open the file.
The -shm and -wal are journal files created using write-ahead logging. You need all 3 files for a complete database. I haven't seen an encryption error falsely triggered by not obeying this rule, but it doesn't seem out of the question.
See https://developer.apple.com/library/mac/qa/qa1809/_index.html and http://asciiwwdc.com/2013/sessions/207.

Proper way to flush database in MVC 4 test application?

In the past I've deleted the .mdf file found in App_Data but that's caused problems for me. So what's the proper way to completely flush the database?

Set working directory when Seed data

I'm trying to insert some sample data (Seed data) using EF 4.3 Migration.
The problem is I want to read data from xml file. But when I run Update-Database cmdlet, I got error like Could not find a part of the path 'C:\SampleData\'.
Is there anyway to set the working directory to current project folder when I run Update-Database from my powershell console.
Thanks in Advance.
I answered your question there http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/437709c0-6933-4ccb-8995-02438500b68b
:)

Resources