android programming can httpurlconnection be used in webroot -


i wondering can connect android webroot of project in order communicate mysql or can done web url? instance examples have seen off android communicating mysql using url such

  url url = new url("www.mysite.net/connect.php");                 httpurlconnection urlc = (httpurlconnection) url.openconnection(); 

but possible this

      url url = new url("mysite/webroot/connect.php");                 httpurlconnection urlc = (httpurlconnection) url.openconnection(); 

the reason being not have website , examples of connecting databases use valid url.

httpurlconnection it's name implies:

  • connect url, gives ip address connect to
  • use http protocol communicate server

first of all, think you're trying achieve local database, database resides on android phone itself. in case, httpurlconnection unrelated :)

there plenty of tutorials , references connecting local database, should start here: http://developer.android.com/training/basics/data-storage/databases.html

however, if trying connect remote database (a database living within internet, , not phone), that's complex beast wishing tackle :p , also unrelated httpurlconnection, mysql has it's own communication protocol not http. recommended access database via restful api, translates website.

good luck


Popular posts from this blog