Novarg
Novarg

Reputation: 7440

Insert a new row in an external database from an iPhone

I'm now making an app that must be able to insert new rows into an external database(for push notifications). The only thing it should be able to do is insert new rows(well, that's not difficult).

The real question is: how can I make a connection/request to a database from an iPhone with a SQL query? For example just a simple

INSERT INTO myTable VALUES (value1, value2, value3);

At the moment I'm using MAMP to run a local MySQL database(later on it will be on a separate server).

Any help would be greatly appreciated

Upvotes: 0

Views: 146

Answers (2)

prashant
prashant

Reputation: 1920

Use web-services. Saving and fetching data bye calling web services. Send parameters to save data on server database.if you want in local also then try to sync the server data to local database that will help you to fetch data in offline mode

Upvotes: 1

Kao
Kao

Reputation: 2272

The Problem with using SQL on a device, is that when you compile your application, you compile into it, the SQL password and username, which can be reverse engineered to obtain.

A way of saving to a database without having to do it from the actual device, would be to make a REST app, and send the information to it, then the application handles the data and inserts it into a database.

Upvotes: 1

Related Questions