How to Setup Database and access database in iphone - iphone

I am working on a new project where i want to setup the database and access the values whenever i want.So i don't know how to start this.what library should be used for this.Can any one help me...
Thanks,
Anish

Core Data can be a good way to get some abstraction: http://www.raywenderlich.com/934/core-data-tutorial-getting-started
Or, go with SQLite: http://dblog.com.au/iphone-development-tutorials/iphone-sdk-tutorial-reading-data-from-a-sqlite-database/

Highly recommend to use Core Data. You can use SQLIte as the store for your Core Data application. Please refer the apple docs here.
You can use SQLite Manager an Add On of firefox. To See the SQLite Store created by Core Data.

Related

Fetch data from JSON server and automatically store in sqlite

I want to fetch data from JSON and store it automatically to sqlite whatever updated on server automatically updates to database whenever program runs.
Can anyone help me out in it. And if my question is not sufficient to answer please ask anything required.
Thanks in advance.
I would look into the RestKit framework. It takes care of the low-level API calls, object mapping, SQLite persistence, etc. It's well documented and maintained.
You can start here http://www.raywenderlich.com/5492/working-with-json-in-ios-5
After reading this, you can user this Class, https://github.com/AFNetworking/AFNetworking. It's easy and usefull!
Download JSON data with AFNetworking and decode with JSONKit, then you can save to SQLite with this wrapper FMDB.
If your supporting iOS 5+ then JSON is added for you by default and can use it using the method given here and after getting the dictionary of objects , you can follow the normal procedure of adding them to sqlite or use core data as said by #Paras Joshi.

How to Create Sqlite database for IOS Application in efficient way?

I have built an android app and now its time to built an IOS app. I am very new to IOS App development. I managed to done all the UI design parts and i am coding the backend part. In my application i am using Sqlite database and has many View Controllers each View talks to database. So i would like to have one Class(Java) which take care about the creating,inserting,deleting etc. If i need to get data from database then i have to call that class to access the database. Is there any way to do like this.
Or
I would like to know how to create sqlite database in a efficient way. Because my app fully based on database.
Thanks for your help guys.
There are two main ways to create a database:
Use CoreData. In this case you should read manuals on CoreData, it is pretty complicated. But if you plan to use iCloud in future, I recommend you to use CoreData.
Create db manually and not use CoreData.
The most efficient way in second case is to use a database manager for SQLite. For example, SQLite manager extension for Firefox.
There are more programs for this, but this is free one, that I use myself.
To work with database use FMDB wrapper over SQLite.
Nice tutorial for second approach.

Implementation for database

I am new in iPhone, I am trying to make an application in which there is need of database for record.
I do not know how to implement it. Is there any one to help me.
You can use core data
Check this Tutorial

core data - how to use?

I want to build an app that uses core data, but all the tutorials I found in the net didn't show if I can store a data without using the code it self.
Is there anyway to do it?
For example, i want to make a row of name and put there couple of names.
I've just read the book "Pro Core Data for iOS" from APRESS it covers Core Data very well. I recommend this by heart.
You can try Core Data Editor. But it's not cheap.
You can use SQLite directly without Core Data; there you'd have your SQLs in your own hands. Your can use Core Data and debug SQLs issued by the framework, of course if using SQLite as the store.
Core Data works also with binary and XML format (the latter not available on iPhone): passing following argument to the application:
-com.apple.CoreData.SQLDebug 1
Other than that, you could probably use SQL to access Core Data SQLite store, since it is all SQL, but it is not recommended.
Unfortunately Core Data is all code. However, CoreData is an api that helps you create, save, load data from the database, it uses SQLLite in an easier fashion.
If you need very complex data storage then by all means use SQLLite directly. But, if it's just simple data storage of names, emails, booleans, etc, then i would recommend CoreData.
I'll give you a link that it helped me greatly when i wanted to integrate CoreData for my app.
CoreData Tutorial
Good Luck.

Which database should you use to program an iPhone/iPad application?

I am new to iPhone development and want to know which database you use to program an iPhone/iPad?
I have heard its SQLite, are there any alternatives to this?
The application I am programming is like an online shop however you can't buy products, only view their details.
You should use CoreData for that. CoreData is a database abstraction layer which uses SQLite to store your data. Or you could use SQLite directly. But I would prefer CoreData.
Core Data Programming Guide
Core Data Overview
If you have any plan to use the database file outside iPhone e.g. in other computer, or data input program to populate data, then SQlite is the best choice. CoreData modify the fields name when you create the database inside XCode. But if the data is only accessed by your app in the iPhone, best choice is CoreData.
If you want to run complex sql query then sqlite is better. Read about NSPredicate, what type of query you can do there.
SQLite is the master choice here!
As an alternative, I would suggest you the simplicity of an XML file.
You can also use NSUserDefaults if u have less data to be stored in your database.
http://icodeblog.com/2008/10/03/iphone-programming-tutorial-savingretrieving-data-using-nsuserdefaults/
If the data to be stored is more then go for sqlite