I'm developing an application in android. I use an sqlite3 database. But I need to implement in mysql database using wamp server.
You'll have to use PHP scripts which handle all the database things on your WAMP.
This script will react as a bridge between your MySql and Android.
After this, make network requests to this script from your Android device and get data returned by the database.
You must understand that MySql isn't available to Android devices locally, thus you can't access it the way you access sqlite on a device. To get this, you'll have to implement something like a webservice.
Related
I'm developing an app that inserts data into database without using any webservies. I've created a database on my notebook with MySQL workbench. I am able to insert data into the database using emulator, but I cannot insert data into the database using my phone.
I have changed the path from
jdbc:mysql://10.0.2.2:3306/ with jdbc:mysql://xx.xx.xx.xx:3306/
xx.xx.xx.xx is from ipconfig of my localhost machine. I've tried again with emulator and I'm still able to insert data, but when I try with phone I cannot. What could be the reason?
You can't access a MySQL DB from Android natively. EDIT: Actually you may be able to use JDBC, but it is not recommended (or may not work?) ... see
Android JDBC not working: ClassNotFoundException on driver
Android cannot connect directly to the database server. Therefore we need to create a simple web service that will pass the requests to the database and will return the response.
See this tutorial:
how-to-connect-android-with-php-mysql
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've created a pre-made database in SQLite for an Android app I'm developing. The app should interact and pull data from the database and display it on different 'Intents'. For now I just want to set up a local server on my Windows Computer for the database.
I was wondering what is the best way of doing so? I have little to no experience with setting up local servers or anything with regards to servers.
Thanks for any help!
There is no such thing as an SQLite "server". SQLite runs locally only through libraries. Also, Android database connections can not simply connect to anything on a server.
If you need a database on a server and an Android client to manipulate the data, you need to implement some kind of client-server architecture, for example using (RESTful) WEB services or any other client-server-communication.
I want to access and replicate data between an Android app and MySQL server (both ways).
I will create a local db and a db on MySQL server.
When internet connection is enabled I will verify the db version, transfer some data to MySQL server, process there requests and get the latest database version on mobile device.
For the moment I found a JSON solution ( http://itweb-projects.com/wordpress/android-connecting-to-mysql-using-php ), but I don't know if it's the best solution. What you think?
If I were you, I wouldn't access the MySQL database directly from you android app. I'd access it through some sort of REST API. This immediately brings to mind the the SyncAdapter class and this great video from GoogleIO.
In my project, I have to connect an Android mobile phone to a remote MySQL database server, to insert data to the database and get the data back later.
However, it seems that Android OS only supports the SQLLite database that works LOCALLY inside the phone.
Does anyone know how to connect an Android phone to a remote MySQL (or MSSQL, or Oracle) database server ?
Thank you!
You will have to access the database using some sort of Remote Method Invocation (RMI).
My personal recommendation is to create a RESTful HTTP interface to your MySQL database on the server. This may be a bit more work, but is preferred for its ease of use and compatibility with any system (that can make an HTTP request that is).
Essentially, you should create HTTP endpoints to Create, Read, Update, Delete (CRUD) data from your MySQL database on your server. Your Android client would then make calls to these HTTP endpoints to perform the corresponding CRUD operations. Of course you do not need to do the typical CRUD operations, you can make your endpoints interact with the database however you wish.
Like I said, a big advantage to this is how extensible it is. You can create another client, on another system, in another language, and all you need to do is make the proper HTTP call.
try using Jdbc... for more read this http://developer.android.com/reference/java/sql/package-summary.html