I am trying to figure out how to populate a Spinner (eventually a whole form of spinners) with data taken from a remote MySQL database. I have read hundreds of examples and tried to replicate them all but to no avail.
I have been working with this example from http://www.mickyjay.co.uk/blog/?p=679
I was never able to get it to work but it seems the most promising out of the lot.
QUESTIONS:
1) Do I need to use a JDBC bridge to connect to the server ? (I was reading that Android does not come with a library to connect to a remote server).
2) I am not looking for someone to do this for me. If anyone has any links to resources that are CLEAR and well documented. I would very much appreciate it.
Since you have MySql database it's good to use PHP to connect to database and send result back to android using JSON response. Android and PHP both support JSON. You can then read JSON and process data as you want in android side. You use HTTP request to run php script. Take a look at this tutorail that shows how to use android, PHP and MySql all together http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/
Related
I am making an android project which inserts information into mysql database via php code. I am able to do so on my local server (using xampp). I have taken a free webhosting byethost7.com domain http://hpisys.byethost7.com for using my database and php file from that server. I am able to open php page on internet and insert the information into the online database server. But via android app I am not able to insert information using the same php code. Please help me out of this.
If you are also using this data in a web project I would set up a RESTful service and get the data that way. If not I would use something like Firebase instead, as it will be much easier to set up.
Either way you will need to research those yourself. You should be able to find a lot of tutorials.
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'm making an application for my project in which the backend database has to be on MS SQL sever 2014 and i'm making android application as front end. I really don't know any specific way to do this connectivity, i have searched alot and got to know about JDBC but i don't know how to get along with.
Your answers will be really appreciated.
You can use a webservice for this. If you'll just deploy your app locally then run your webservice locally. Use the Android AsyncTask class to connect to your database by making a post or get request via webservice. Your webservice then will be responsible for all the database query.
So the data diagram would be something like this.
Android App <----> WebService <----> Database
After the WebService gets the necessary data from the database then it could now send those data back to the android application who made the request. You can choose different ways for making a webservice like by using ASP.NET, PHP, or JAVA.
Yes, You should use WebService handle this. You can very easy use Slim (PHP micro framework ) To cope with all sorts of different language and context.
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
Hi I am currently making a simple application in android that would connect to my database in Heroku and I was just wondering how I would use java code to connect to that database and fetch, and data to and from it?
Could someone give me advice on how to start. I was looking at this code for starters https://github.com/heroku/devcenter-java-database but I am still confused on how to fully understand the code. Do I need a .pom file and what is it for? And where are the values of "DATABASE_URL" and how would I be able to connect to my database that I made in Heroku etc.
Thank you for the help
Generally you wouldn't have a mobile phone connect directly to your database. You'd need to allow access to your db from the internet, its considered a bad idea for security. Instead you write a webservice that sits between your db and your client. The webservice reads the database, packages it up into some data format like XML or JSON, and sends it to the client who parses those values and does something with them (display, calculations, etc).
#Gabe Sechan is right. you need to build a API. your app will query the API and the API will get the data from db and sent back to Android via JSON...
To learn more abour API have a look here :
http://www.andrewhavens.com/posts/20/beginners-guide-to-creating-a-rest-api/
or a list of tutorials
http://blog.mashape.com/list-of-40-tutorials-on-how-to-create-an-api/
Hope this helps u buddy.