Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

srinivas.be88

macrumors newbie
Original poster
Aug 10, 2010
24
0
hi ,
Hello, Can somebody please provide some example code to how I might connect a iPhone to a remote mysql database directly ( I know it's not the best way but is what is required for my app) ....

i need to upadte a database and retrive information


i am using cocos2D template to connect to the database
 
I don't know what you are planning on doing, but connecting remotely to a database is a horrible idea.

First, you basically eliminate any security that is built into the database. The username and password will be sent across the network in the clear, not to mention stored in the app. If you want to do something like this, build a web service. Have you iPhone app connect to a web server running something like Java, PHP or ASP that provides an interface to your database.
 
I don't know what you are planning on doing, but connecting remotely to a database is a horrible idea. >snip<

For every tool there is a purpose. There are plenty of good reasons why OP might want to connect to MySQL directly. Maybe he's writing a MySQL management tool for iPhone. Maybe he doesn't want his product to require a web front end, for simplicity's sake. Maybe's it's a bespoke line-of-business app that will only get used in a particular way.

He can secure connections with ssh or SSL, if that's a requirement.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.