I am writing an iOS application that needs to access data from an external SQL Server 2005 database. I already have a website that accesses the same data.
I usually access the SQL server database using .NET along with stored procedures for security reasons.
I need to populate an array that will itself populate another TableViewController.
As I'm fairly new to the whole iOS thing, kindly let me know how I can do this. If it's possible, please suggest the syntax or Google keywords for this.
I'd recommend making a simple WCF .NET REST Service that queries your database and returns what you need.
I'm pretty sure your iOS app will not be able to connect to it directly.
Check out the following;
http://msdn.microsoft.com/en-us/library/bb412178.aspx
http://www.codeproject.com/Articles/105273/Create-RESTful-WCF-Service-API-Step-By-Step-Guide
The code project tutorial is very easy to follow. And you can download the project code.
It sounds like you will want to make an API to access your database and you can access it through web requests. Essentially you will be performing web requests and respond from your site in json or xml where within your iOS client side code you can parse that and do what you need with it.
Related
I 've been thinking about a project for a Website and an iOS app. I have some domains (Webserver) with SQl. It should become sth. like a News-Blog about a special topic.
So I want to ask, if it would be possible to upload an article into SQl and load it to my app and website.
The problem is, that i've never worked with Sql before and have absolutely no knowledge about Sql. The app would be made in Swift and the Blog(Website) with Wordpress.
So, how should I proceed and where do I have to pay attention?
(Sry for my english, but i hope you understood what I want to do)
SQl = MySQL version 5.5.49
you can load data in ios app using REST API.
when you are done with you SQL integration with Wordpress you can use wordpress Web Services plugin for iOS app.
plugin http://v2.wp-api.org/
In iOS app you can use Alamofire Web API Framework to handle Web API request. https://github.com/Alamofire/Alamofire
I don't know if I clearly understood your question but I think that your main concern is to know whether it is possible or not to use a single database to store the data from BOTH your mobile app AND your website.
The answer is yes. The database will be the same, the data is simply displayed in two different views (website or mobile app).
Note that SQL will only be used to get or to add some data in the database.
Wordpress uses SQL to store data, and you can use SQL while you develop your mobile app to store or to get data from the database created by Wordpress.
SQL is the language and MySQL is the DBMS (DataBase Management System), these are two different things, as I think that you are confused about this.
I need to Query an online SQL database from an iPhone app. I have been researching and have not been able to find a way to use SQL to directly query my non-local online database from my iOS app.
Is there any way to do this?
Or do you need a web service, restful api using json?
If so, can you lead me in the right direction on creating a web service (or resources that handle that for you)?
I have be trying the same thing and I endet up doing it via a MySQL DataBase on a 1&1 web domain, to Query the DataBase I made a PHP program, using (like you said) JSON to be read by the app. I dont know if that is what you meant if not maybe specifie pls. XD
I am currently working on a social-networking based app on iOS. I try the online DB service and cloud service provider "Parse". But what i really do through this platform is just to retrieve data for the "users","messages" and "activities" in that DB.
I want to implement the recommendation function into my app which requires some sort of logic after the retrieval of the data. Is it feasible to integrate some of this logic into the "Parse" platform and avoid setting up the server?
If I understand your question correctly, you are asking if you can have server side logic run on the Parse side? Yes, you can and this is fairly standard practice in the Parse universe. You an use Cloud Code, which is Javascript run on the parse servers and you can link the scripts in to before you save objects, after you save objects, or just standalone functions. Here are some details:
https://parse.com/docs/cloud_code_guide
Hope that helps!
I am planning to build an iOS app with using DB(Ms-Sql).
However, people recommends not to access DB from Xcode.
They recommend me to use php or asp for accessing db through a webpage.
I want to know the reason.
Also I am going to use DB only for (view) select line (not insert, update nor delete).
so is it possible to access directly to db for viewing purpose only?
thank you
It's generally bad for an application (mobile, web, any client) to directly have access to any database for security issues. Clients really should not be accessing the database, which is often holding very private/secure data. It opens up vulnerabilities (i.e., sql injection attack).
A set of web services written in php or java or some back-end technology is a more secure, scalable system. These web services can connect to the database and retrieve data. Your iOS application can call the web services and receive the data..for example in the form of XML or JSON.
I need to populate a table in an iOS application with data from a Web database
I already have a MySQL database set up but reading about this it seems there must be an easier way for the iOS to interact with a web database
Any help or pointers would be appreciated,
Thanks
You should make an API interface.
Then use the API to communicate with the database. Using the database directly is a very bad thing to do.
If you are really desperate, consider using the MySQL C library. This article explains it in great detail:
http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/
For my application, I chose to create a web service to act as an intermediary between my application and the database.
This layout has several advantages. Considering you have MySQL database you can try to create some php scripts (I chose php because the API to work with mysql is very very simple and as you said, you don't need very high security or performance).
You can use these scripts through HTTP requests (you can use NSURLConnection to do these).. These scripts connect to mysql , fetch the data you need to pass the result back to the application in an easier to use format (e.g. I use JSON).