tags:

views:

550

answers:

3

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

+1  A: 

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.

Nathan de Vries
A: 

Thanks for the quick reply, all i need to do is backup the addressbook.sqlite.db file from iphone (non jailbroken) to a server(which can be anything say cloud or a web server) and restore it back to the same location on iphone. and one more question Nathan is there a way to get the location, name , and extension of an image resided on iphone.

Thanks Satish

You should use the comments feature rather than adding a new answer. It's impossible to upload the sqlite database directly from the phone to a web server because you don't have that level of access, although you could use the address book APIs to create your own database and upload that to a server.As for your image question, it should be asked in another question.
Nathan de Vries
A: 

Yeah sorry abt that. ok thanks probably i will create a new database using AddressBook Apis

-Satish