Get data from SQL Database

Hello everyone!


I'm quite new to iPhone development and I've been trying to find find what I'm looking for elsewhere but I'm unable to find anything close.

Today I have a SQL database I would like to get data from and display it in my application. For example get all the rows from a table in my SQL database and view the result i a table view. So the data should not be "offline" data stored in a core data database or anything like that.


Do anyone know if this is possible somehow and how to do it?


Thanks in advance!

iOS/Xcode-OTHER, Mac OS X (10.6.7)

Posted on Jun 17, 2011 2:13 PM

Reply
8 replies

Jun 20, 2011 2:26 PM in response to xilver

If this is SQL Server (or any other client/server RDBMS)... Even if iOS had a native SQL Server client, it would probably not be advisable to use it. Typical client/server database applications are deployed in an enterprise where the SQL Server ports are open. iOS users are typically on a wide area network (3G, Starbucks wifi, etc.) and might not always have a network path to your database server. You should deploy a REST or SOAP API on your server and access that from the iOS app using HTTP.


SQL Server natively exposes database query results as SOAP using SQL Server XML Web Services, but this feature is deprecated so not advisable for new applications.

http://technet.microsoft.com/en-us/library/cc280436.aspx


So you should develop your own REST or SOAP server-side API using ASP.NET (assuming you are a Microsoft developer). If this is a data-intensive app, consider syncing subsets of the data locally into Core Data Model for high performance, otherwise every action the user takes will incur a delay while fetching results from the server.


An alternative for a simple app would be to do everything on the server by creating an HTML5 app.

Jun 17, 2011 4:29 PM in response to xilver

You stated 'Read local (=not offline) database...display in app'.


The link explains how to put a database in your app bundle, meaning local, not offline, so the obvious answer to your question "...is it possible" = 'yes'.


Did you have an additional question beyond that?


>Because it begins with SQL does not mean the same thing as a SQL database.


I'm talking about SQL databases (respecting your topic title "Get data from SQL Database")...what are you talking about?

Jun 17, 2011 4:00 PM in response to K T

Ok. Either you have not read what I was looking for or you don't know what you're talking about. Because it begins with SQL does not mean the same thing as a SQL database. Sure the language is the same. But I already have one database which I want to extract data from. Not create one locally. I don't have mine locally.

Jun 17, 2011 5:34 PM in response to xilver

You put "sqlserver" as a tag on your post. Does this mean you are trying to connect to a Microsoft SQL Server database? If so, you've got your work cut out for you. I don't know of any non-Microsoft client code you could use. That doesn't mean there aren't any. That is just an insular community. The clients are always Windows and Windows comes with the client code. Your best bet is an intermediate web site that will consume the SQL Server data and make it available to your client as XML. Microsoft is pretty XML-friendly so there might be some service that SQL Server itself provides.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Get data from SQL Database

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.