Friday, May 6, 2011

How to connect to a MySQL database from an iPhone?

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.

From stackoverflow
  • A quick google will show you the way...

    Epsilon Prime : Specifically look for http://mysql-cocoa.sourceforge.net/
    bentford : -1 Wouldn't it be clearer to have linked to mysql-cocoa.sourceforge.net and even state that it indeed does work on iphone.
    Oli : 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.
  • use sqliteManager

    bentford : -1 this is not a obj-c mysql library
  • well i have the resource of wordpress for iphone i dont remember were i find this but here are a form to manage data via web and i have an example with an sqllite data base downloaded from developer.apple.com

    bentford : -1 unclear what this means.
  • Assuming you have some experience with server-side programming (ie PHP), you could just create a 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

0 comments:

Post a Comment