14

I am trying to connect to a remote mysql database from an iPhone. I have searched many web sites but I did not find any help. If anyone has worked with this please send a solution.

Chris Hanson
  • 54,380
  • 8
  • 73
  • 102
Md Nasir Uddin
  • 2,130
  • 8
  • 38
  • 59

2 Answers2

13

Assuming you have some experience with server-side programming (like PHP or Rails), you could just create an NSArray from the content of a URL where you establish a connection to the MySQL server and print the results you want in ASCII or XML format.

NSURL *myURL = [NSURL URLWithString:@"http://www.myserver.com/results.php"];
NSArray *sqlResults = [[NSArray alloc] initWithContentsOfURL:myURL];

Also useful to help you format the results printed by the server page: http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html

samvermette
  • 40,269
  • 27
  • 112
  • 144
2

A quick google will show you the way...

Oli
  • 235,628
  • 64
  • 220
  • 299
  • -1 Wouldn't it be clearer to have linked to mysql-cocoa.sourceforge.net and even state that it indeed does work on iphone. – bentford Jun 15 '10 at 20:40
  • 7
    Not really. Some people need to learn to use Google before opening a StackOverflow thread. Click the link and you'll see how lazy this question is. – Oli Jun 15 '10 at 20:43