Wednesday, March 30, 2011

SQLite 3: Mass Data Load Issue: Error 14 Database Not Found

I have an iPhone application that is a data load harness to pre-populate database with data that will be shipped in a separate application. When I kick the program off I am reading from an XML file and the records are inserted into the database.

Everytime I hit the 247th record in the list the database then returns an error 14 database not found. If I stop the program, remove the 247 entries from the XML file that were just inserted and I restart the program again... the same thing happens. The next 247 records will be inserted then a failure with error 14.

I have over 30,000 records to load. Loading these 247 records at a time is not really a good option.

Any ideas on what is wrong?

From stackoverflow
  • I have no idea what's wrong there, but maybe you can automatically close and reopen the database connection every 200 records to work around it.

    radesix : Unfortunately this doesn't work. Closing the db and reopening in code doesn't fix the issue.
  • How are you managing transactions? You probably don't want to insert everything in a single block, but then neither do you want to add every record in a separate block.

    radesix : I've tried each record as as it's own transaction as well as inserting blocks of records in a transaction. In either case, when I got to record 247 in the list it failed like clock work.
  • DB2 has functionality in its IMPORT and LOAD commands that allow a commitlevel. It may not be the best answer, but check the docs to see if you have a way to commit every 200 rows or so. This way it's hands-free.

0 comments:

Post a Comment