TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How would you do a database connection in an iphone app?

2 pointsby roversoccer18about 14 years ago
I am trying to develop an iphone application that needs to connect to a database. After about an hour of googleing I found that there a lot of ways to go about doing this(SQLite database locally on the iphone, MYSQL wrapper class to connect to a database, and many other). What is the best method or convention most developers use? Does the iphone SDK have any built in NS objects to connect to a database?

3 comments

jacksondabout 14 years ago
Local Data: Core Data hooked into a sqlite.db is the way to go. Some say it's a little heavy but I have had a lot of luck with it. It's going to give you everything you need to persist and query data locally on the device.<p>Remote Data: You pretty much have to go with a web service layer. The standard now-a-days is RESTful JSON. Directly connecting to a remote DB is too unreliable for the mobile world.<p>ASIHTTPRequest: A wrapper around network level API's for connecting to web servers. Use this.<p><a href="http://allseeing-i.com/ASIHTTPRequest/" rel="nofollow">http://allseeing-i.com/ASIHTTPRequest/</a>
ConceitedCodeabout 14 years ago
Depends on the app but generally speaking I would use CoreData to map the object and store it in SQLite database.<p>I can't think of any reason you would use a MySQL wrapper. If I wanted to get something from a MySQL database I would set up a REST api on my server.
Dnguyenabout 14 years ago
We use a web service with JSON. On the iPhone, we use HTTPRiot to talk to the web service using JSON.