views:

70

answers:

2

hello,

i m creating inapp purchage subscription module, in this app i want to access remote database but problem is that how i connect my objective-c code with the mysql on the server,

i am not found any sufficient refrence please help me if any refrence or solution is there.

+1  A: 

In mySQL, all access from your application to the database server is already remote access. Local access is simply one case of remote access.

If you're working locally, you may be using "localhost" or "127.0.0.1" as the hostname for your data base, and 3306 as the port number. You're using the data base name you set up on your local server, perhaps "arunsdata" or some such thing

You need to find out the hostname and port number of the remote data base server. (The port number is probably 3306.) Then you need to modify your application code to specify that hostname and port number.

Before you do that you will need to have a username and password, and create your data base ("arunsdata" or whatever) on the remote data base and create your tables and other schema items. The administrator of the remote database server can probably help you with this.

Good luck! I remember how confusing this was the first time I faced it. It's simpler than it seems.

Ollie Jones
Thanks for ur answer,i have the host name of our database,and port no.and i also create remote database and i also have user name and password of the remote database,but how i modify the code if u have a code then please suggest me.Thanks a lot.
Arun Sharma
Please post the code you're using to connect to your local data base. It's a line or two, no doubt containing the "connect" verb somewhere. Then, I'll be happy to help you adjust it.
Ollie Jones
Actually before this i m using sqlite,it is file based so i specify only database name then it automatically connect.if u have any code then tell me ,
Arun Sharma
Arun, SQLite is a different data base system from mySQL. This is no one-line change.
Ollie Jones
A: 

You should probably create a web service to access the remote mySQL server database. You can then send a request to the service using NSMutableURLRequest. If you need to return data back, return json since its more light weight than XML.

Neil