i need to copy this database file and save it in someother location or i can take backup of the db file. is there a way to do this programmatically.
Thanks
Satish
Unless you've jailbroken your iPhone, there's no way of accessing the sqlite3 database directly on the phone.
If you're talking about getting access to the database from your computer, you can do it by grabbing the database files out of the iPhone backup files. To do that, you'll need to grab a copy of Erica Sadun's mdhelper (binary file) command line utility, and run it from the PC you sync your laptop with like so:
mdhelper -files "AddressBook.sqlitedb" -extract -glob
This will create a "~/Desktop/Recovered iPhone Files" directory containing a file called AddressBook.sqlitedb, which you can access directly or query using your programming language of choice.
If you don't trust downloading and running binary files without knowing what they do, you can look at the source on Github and compile it yourself.
the SQL database can be extracted from an iphone backup. I used this software to grab mine and the SMS database.
If you have lots of images/videos in camera roll it can take a while to run.
http://www.supercrazyawesome.com/
Yeah sorry abt that. ok thanks probably i will create a new database using AddressBook Apis
-Satish
You can also take a backup of your iphone and than use one of tools discribed here to identify the file you need.
Related
do we have any command line from where i can query the sqlite database, which is created by coding, and stored in the application's default Documents folder?
Turn on file sharing for the app, copy the database file to your Mac, and use the command line tools (sqlite3) that are there.
(Note to the previous editor: I appreciate editing of answers for accuracy, format improvements, and fixing typos...but, if you want to provide completely different information, I suggest providing your own answer instead of changing the meaning of another user's response.)
I'm developing an iphone app that retrieves the call log information and store it with the number of missed,incoming and received calls over that time. Here, since the call log is a .db file, i have to first access the call log details and extract it using C++ and sqlite.
Can anyone suggest me how to extract the table named "call" from call_history.db database file and store it in a text file?
I don't think that is allowed by Apple to access the call history database... If it is, which I seriously doubt, then you should be able to open it using sqlite3. There are plenty of tutorials available online how to do this but again, I think, if it is even possible, that your app will be rejected for this...
If you still want to try, the call_history.db file is probably a sqlite3 database.
Have a look at the documentation to see how to access it from your code. If you want to analyze the contents first to find out the schema, just use the command line application sqlite3.
I'm looking for an easy way to make sense of a SQL file that I've pulled from some application data in an iPhone backup. It's a huge file with bits and pieces of readable data strewn throughout, and right now I'm reduced to using a text editor to pick through it, which will take years.
Are there any simple SQL viewers available that would work for someone with limited technical knowledge? Or is there a way to export the contents of the file to a more easily readable format?
Really appreciate any help!
Try Base, it is a paid app, but they have a free trial if you download outside of the Mac App Store. I use is daily for sqlite db's
I use SQLiteManager.
There are several other sqlite viewers, like Navicat, but I haven't used them personally.
Alternatively, you can just use sqlite on the command line:
sqlite3 path-to-file
.dump
.quit
I am developing my first iPhone app, which includes an sqlite3 database that should contain approximately 1.200 records. These records are created by me.
During the tests i have created them in a .txt document and inserted the .txt into the database. This is a very inconvenient method to do this and i would just ask for some advice how to do this in a convenient way. I have been thinking about some external (free) databse, excel
Use the mysqlite3 program on you Mac, to create the database. Then place the database into your App's bundle.
When you program launches, see if the database is in your app's "Documents" directory. If not, copy the one from the bundle to the Documents directory.
The mysqlite3 program on your Mac will generate a database which is compatible, and sufficient to use on your iOS device.
You could use excel to create a csv (comma separated) file - then you'd just need to parse it. If you already have the db started - you could also just use sqlite3 at the command line.
I currently have an iPhone app that reads data from an external XML file at start-up, and then writes this data to the database (it only reads/writes data that the user's app has not seen before, though)
My concern is that there is going to be a back catalogue of data of several years, and that the first time the user runs the app it will have to read this in and be atrociously slow.
Our proposed solution is to include this data "pre-built" into the applications database, so that it doesn't have to load in the archival data on first-load - that is already in the app when they purchase it.
My question is whether there is a way to automatically populate this data with data from, say, an XML file or something. The database is in SQLite. I would populate it by hand, but obviously this will take a very long time, so I was just wondering if anybody had a more...programmatic solution...
I'm going to flesh out Jason's answer, I've marked my post as a community wiki so I shouldn't get any points for this.
He's not talking about a dummy app - write the app as you normally would, but check to see if the database exists in your main bundle before you call the code that populates the plist. You run that in the simulator, pull out the generated sqllite database, and add it to your project - if you only need to read from it, you can read it from the main bundle directory. If you need to do further writes then copy it into the writable documents area, and use it from there. So basically for the main user, the code to populate the DB would never be called...
The only downside is you also end up including the plist files you are reading from, even though you only need the database. You could make a different build target that was a copy of the main one with the only difference being that it held the plist files, while the main target you built for the app store did not.
Not to take Jason's answering thunder, I can't comment yet so it has to be here.
The nice thing is that you can access the filesystem of the simulator right on your Mac. I am away from mine at the moment or I could tell you exactly where to look, but I just find it by putting the name of the db file into searchlight and just running with that.
You also do not need to wright any code to populate the db since you can use the command line tool to do the initial setup if that is more convenient.
You will need to copy it over though since resources are stored in the read only signed portion of the app bundle.
I had the same problem of you using sqlite, on massive insert it's really slow. So the best way it's provide directly a filled sqlite database.
You have another way, instead of INSERT INTO, to populate a sqlite db. You can produce a csv file for each table and load into the tables using your computer and the sqlite shell:
Just 2 simple commands:
.separator SEPARATOR
.import FILE TABLE
Example:
adslol:~ user$ sqlite3
SQLite version 3.6.12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .separator ;
sqlite> .import myData.csv nameOfMyTable
sqlite> .quit
I hope it's what you was looking for :)
If you need a good client for sqlite3 try SQLite Manager, it's a Firefox add-ons.