I want to connect my android application to an external mySQL database and I found that I have to use web service to achieve that using php code.
but I used to use java, Is there in java any equivalent to php code??
It depends on how the server side is implemented. Both php and java can implement the server side code and access MYSQL DB. Through your android client you dont' have to be concerned about the server side (If the server is not yours and just responds to your queries) , you have to make HTTP request POST or GET to achieve it.
Related
I want to insert the data in mysql from android. I use php webservice for transfer the data.
Which url is used to transfer the data? Which method is used for android webservice?
Not Possible as best as i know android. You need use PHP or J2EE running as your using already Wamp, and expose as apis.
I'm making an application, I already have a website nodejs with expressjs framework and mysql database. how to process the input, update and delete data from android to mysql without using php server side? if anyone has ever made before? thank you
Basicly that's what the server side code is doing!
Handling all the data and requests between the two (android app & the relational database)
Any attempt to not use the PhP or any type of language for that matter would cause only to iconically change some data from the app!
But that's not the case since you want to alter also the database as you clearly mention!
As for the how: The only way to use the data transfer to the app is by the use of json packets!
A exchange should be made between the app and the database "through" the server side php code and they should exchange json files with data!
Then your problem is solved.
I have a web application on Android and iOS which uses html and javascript for the project. I now have local values and app works fine. now I want to use a mysql database for my inputs, are there any good tutorial or sample codes on how to do that.
I'll appreciate if you can help me with this.
Thanks
For web app and mysql communication need a scripting language like php and for database you need a database like mysql there is simple tutorial fo mysql connectivity
http://www.androidhive.info/2013/12/android-populating-spinner-data-from-mysql-database/
You need to choose a language that will operate server side to manage the database of your web app, e.g. you could use PHP as a language and MYSQL as a database software (it's free and awesome), for examples you could use http://php.net/ and search how to use specific mysql commands in PHP, or use a framework like CodeIgniter which has built in functions for database management and you can view some of them here https://ellislab.com/codeigniter/user-guide/database/active_record.html, but make sure you use the whole user guide on how to use it and how to set up your database configuration properly!
EDIT. If you don't want to use PHP for the actual app then you can use it server side, i.e. use it as part of a server file which connect to database, handle data, send it back, then send it back to your remote app where you can handle it with Javascript.
I have a script in java that works like a crawler and saves data in MySql DB. What i want to do is build a Mobile App(Andriod/ios) which will connect to mysql database retrieve results and just show it to the user.
What is the best approach to this ? I tried to use Flex UI with PHP as my server client but was hoping to know if there is a better solution ?
The fastest would be to make android fetch a page in XML, typically on the server and display its contents(If displaying contets is your desired result).
else
You need to implement a script on your server, your POST interacts with that script and inturn that script works with your database.
A typical scenario will be:
Java HTTP POST ~~~> PHP ~~~~> MySql.
PHP will as well help you encode the result in JSON and post it back to your client.
Try using jdbc or jtds library to connect android app with mysql
I used jdts library for connecting mssql db using android app.
http://jtds.sourceforge.net
For mysql jdbc might work
I have been reading the tutorial shown on various websites on connecting a MySQL database using php to android. I dont know where to "put" save my php page which will communicate between the MySql database and the android application.
can help me?
Without you showing the tutorial it's obviously guesswork, but I suspect they talk about a server (with mysql) and an app.
The php page runs on the server (or another server that has access to the mysql server).
You put it on the web-directy on that server, which should run a webserver (apache for instance) next to the mysql server it should run.
I run a VPS which runs MSSQL server and runs a web service in .NET which I host on a domain. My Android code then calls this domain/web service.
PHP would be the same. You'd host your .php file on a web server somewhere that you can access.
Recently we have implemented this in one of our apps. PHP script/page resides on your hosting server, using this php script/page you will communicate with mysql database and returns the response as Json string. In app, you need to use HttpClient to invoke your php page/script. Then use JsonObject to parse the json response.