user359187
user359187

Reputation: 2279

android mysql connection

Hi im new to both android and java

i have php page in my webserver, i want to get this page result in android. I have search a lot for mysql android connection someone says that it is possible through "new URL" in java. But i cannot catch this method. Actually i want to implement a login page for android. I have already created a login page in php. Now i want to just post username and password value to php page the php page will check the data with database and if user is a valid user i need to redirect otherwise i will show an error message.

thanks

Upvotes: 3

Views: 30843

Answers (2)

Bryan Denny
Bryan Denny

Reputation: 27596

You should consider writing an API on your webserver that returns JSON data to your client.

Then for example you would call the php page http://yourwebsite.com/api.php?method=login&username=user&password=md5password

The webpage would then return a JSON data result that your Android app can parse for a result (200 success, 403 access forbidden if they entered a wrong username or password, etc. etc.).

An example. And here is another.

Upvotes: 9

kaw
kaw

Reputation: 75

An other approach is to use a Virtual JDBC Driver that uses a three-tier architecture: your JDBC code is sent through HTTP to a remote Servlet that filters the JDBC code (configuration & security) before passing it to the MySql JDBC Driver. The result is sent you back through HTTP. There are some free software that use this technique. Just Google " Android JDBC Driver over HTTP".

Upvotes: 0

Related Questions