Is it possible to connect to a mysql database using android service and asynctask without using any server site scripts such as php??
My application needs to create an offline replica database, and synchronize if updated by user.
Please give suggestion and possible links, references or code.
Thanks in advance.
be aware of this :
if you connect to a remote DataBase without using a webService you will store the database login credentials inside your app. so it'll be easy to extract your login for that database and access and edit it even destroy it by decompiling your app.
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 a native android app with has some user data that I want to be stored in a database.
I'm planning to use Heroku to host it. The app should be able to retrieve it and overwrite it.
Right now, I am very confused as to how to start working on it.
There are three parts:
1)writing the actual database: right now I'm using SQlite database browser. I have created a simple table database. I have no clue how to deploy this to Heroku...
2)writing a REST API to communicate with android app on device: I gather that I should also deploy this to Heroku?
3)Connecting with the device: ??? I have no clue how this works... do I write a REST API in my native android app too?
Very confused! thanks for reading.
You should follow these steps as per my knowledge:
The database that you create should be for the device(the one that you have created using sqlitebrowser.
Create a separate database at the server side and create an api that'll perform CRUD operations using an xml or json file to reflect the data in it in the database at server
whatever operations you perform you can do them in the local database and later after checking the internet connection write the edited valueds in xml or json format and send it to your server where it'll be synced with the server database.
I have been learning SQLite on Android and have done some tutorials on how to use it.
There is a question that I want to ask.
Is there a way to make my app connect to my MySQL database in a remote web server of mine so that it can read data and also write data to the database?
From what I've researched, SQLite cannot be used remotely and I would need some kind of Web service in between?
It's not easy to create a connection to MySQL from Android, if it's not impossible. With that, it's also not safe if for example someone decompiles your app they have access to your whole MySQL database if you don't limit it enough.
For those reasons, you can better use a (for example) PHP webservice to which the Android application sends all their requests. An example is available at http://www.helloandroid.com/tutorials/connecting-mysql-database.
I also suggest you use Android Asynchronous Http Client so you don't have to deal with connectivity issues and AsyncTasks yourself.
You can refer to this tutorial but you do need a web-server for it.
Request mechanism
Android App ----> webserver ------> database (mysql)
Respond mechanism
Android App <---- webserver <------ database (mysql)
Android App will use JSON or other to get the data and display it
You have to use Sqlite database and web Services both. First you have to save the data in local database i.e. SQLite database and then send this data to your server using web services and vice versa.
this link for web services
and this link for SQlite will help you understand.
Thanks.
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.
I'm developing a web app with Java Servlets that can access an oracle database through the Tomcat server. I am also developing an android app that I want to use to be able to display the information that is stored on this database, so I will need to provide the user with the ability to log on and access the data from the database. The information will then also have GPS coordinates to display the items on a map.
Any ideas of the method or process involved in achieving something like this? Thank you!!
One really easy way to solve this problem involves using another product from Oracle, Database Mobile Server.
Having your Android devices connect to Oracle Database over the network has serious security and other implications.
Instead, you can just use the local SQLite database that is built into Android. Database Mobile Server provides a sync client that runs on each Android device, and synchronizes the local database with the remote Oracle Database in the background.
You can read more about the product and download an eval copy here:
http://bit.ly/tLjaF7
Good luck with your project.
Regards
Eric, Oracle PM