iOS Database Limit to 5MB (Solved – Hacked)

April 6th, 2011 § 2 comments

Hi all,

As we know, iOS only allow us to have 5MB Database if we use web-base application. I also faced the same problem when i’m doing application that need more than 5MB Database size on iPad / iPhone using PhoneGap as a wrapper.

After some experiment on iPad and iPhone, i found some thing that very interesting:
1. We cannot define / open database with more than 5MB size allocation.
2. We able to define / open more than one databases that each one has 5MB or less size allocation
3. Every databases being recorded in Databases.db under ‘~/Library/WebKit/Databases’
4. Databases file is stored in ‘~/Library/WebKit/Databases/file__0’ path.
5. ‘~/Library/WebKit/Databases/file__0’ folder has limit definition (5MB) in Databases.db under origin table.

What i did:
1. Run my application using iPhone / iPad simulation (run it once)
2. Get the Databases.db file under simulation folder
3. Open Databases.db using SQLite client, in here i’m using “SQLite Database Browser 1.3
Databases.db File

4. Go to Databases table and change the size manually for every databases that you create.
Databases table
5. Go to Origins table and change the path (folder) file__0 limit. you need to do this step, or what ever you did in step 4 will be doing nothing.
Origins table
6. Save the changes.
7. Import this file Databases.db to project – resource.
8. replace the original file Databases.db with the modified Databases.db every time you start the application.

After doing that step, my application allow me to have a big databases, and the folder size limitation also solved, hope this will help you guys.

Have a look at this, Solve the limitation without using this hack.


Tagged , , , ,

§ 2 Responses to iOS Database Limit to 5MB (Solved – Hacked)"

  • Irfan M says:

    Hi Helman, nice to see your blog here.

    This is my first comment, the truth is i don’t know anything about ios but this post was
    very interesting. Hope can be usefull to anyone.. 🙂

  • Ed says:

    Hi Helman, this seems to work fine however looks like it only works after I get the initial out of storage space “there was not enough remaining storage space, or the storage quota was reached and the user declined to allow more space”

    After that If I reset the tables and try one more time it will work, any ideas on how to get around this. Since it seems that it only reads the database.db table only after reaching the 5MB quota limit.

Leave a Reply