I´m currently creating an android app through a form that saves data in a table with SQLite.
I need to include a function that when the client click "upload" the data in that table get on the actual table MySQL server and remove the table created by SQLite.
Anyone have any example of how to do this, if you could automate the action when the device has Internet would be perfect, thanks!
I would be very surprised if there was something that can do that out of the box. You'll need program something to extract the data from SQLite, format insert queries for MySQL and run them.
Related
guys I'm a beginner Android development, and I want to create a static database and then connected to my android application my Wishes:
user register from the application and that database should perform CRUD operation
I don't know how do I create it that database
I need help someone help me
Thanks
If you want to Learn about database CRUD Operation then there are Videos of Slidnered Link for examples in Sqlite performing CRUD Operation,
Another from the Examples of Androidhive click this link.
For getting Proper understanding with multiple tables then you can try this example from the link for Multiple table example.
I hope you will get better understanding from these examples about the CRUD operation on Sqlite database.
I want to create a static database and then connected to my android
application
The things you probably looking is SQLiteDatabase
SQLite is a open source SQL database that stores data to a text file on a device. Android normally comes in with built in SQLite database implementation.
Here is one of the Android SQLite Database Tutorial
P/S : If you have uninstalled the app, all the data will de gone/deleted together.
Another approach is using PHP script then connects to MySQL database to perform the operation. User still able to get back his/her data as long as he/she still remember username and password.
Example: How to connect Android with PHP, MySQL
I have an Android app on the play store which uses a local SQLite DB on the device.
However, in a planned update, I want to sync the SQLite DB with an external MySQL server with the same table and database structure, through a PHP webservice.
However, in this case, I not only want to make sure the changes in my SQLite DB are reflected in my MySQL DB, I also want to make sure that the changes in my MySQL DB get reflected in the SQLite.
Would appriciate any suggestions about how to go about it.
When you call method of web service for update external MySQL server, this method can return result of this update to Android client.
please refer this link and check first two tutorial . it may solve your problem
I'm building an android game, and when finishing the game the user can insert his name on the highscores table.
The highscores table is a table in a SQLite DB that is stores in the device as part of the game.
What i'd like to do is to store this information online, so the user can choose between see the global highscores table or only his local highscore table. The local part his done.
But what do I need to create the global highscore table?
Create a DB online?
How to update and select it from android?
I read about webservices,I only need to maintain a table with 4 fields what is the simplest way to do this?
Which api should I use : Rest ful api would be good option or Http Client-server
Thanks in advance,
-To make global high-score table, u gonna need online database.
-To update and select record, I use php script to do that job, like api for my own app. You can use xml parsing to send and receive data. Here is some nice tutorial for android xml parsing.
http://www.ibm.com/developerworks/opensource/library/x-android/
http://p-xr.com/android-tutorial-how-to-parseread-xml-data-into-android-listview/
Hope this can help =)
To update in online data base ,you have to use webservice .
Send data(Highscore and other parameter) by appending to webservice on
finishing of of game
You can maintain table on online server, and when you post data,then it will
return allready made high score in responce.
Get responce and show it in user interface
This is the way to store data to online database ,i have developed an app that doing same thing.
We want to get the remote database data into local database first and then we want to access the local database. Can you please suggest us how to approach for this with sample code. Our remote database is MSSQL Server.
Have the app query the remote server, return the data from MSSQL to android code via JSON, insert into SQLite.
Edit: type MySQL to MSSQL
Get desired data from mysql ...in the form of xml from server. Parse that xml in android and fill desired java beans inside collection. then write state of object's in collection to sqlite dataabase.
I would suggest next time providing some code that indicates at least that you attempted to connect to your database first, and then if you run into trouble, someone here may be able to help. As opposed to just asking for sample code.
If you're talking about replication, I'm not sure this is possible from SQL Server to SQLite, otherwise, the answer to your question is simple, you would connect to your SQL Server database probably through some sort of exposed API, retrieve the data, parse it, and update your local SQLite Database accordingly.
Here's a link to a tutorial that covers connecting to local databases: NotePad Tutorial
We want to get the remote database data into local database first and then we want to access the local database. Can you please suggest us how to approach for this with sample code. Our remote database is MSSQL Server.
Have the app query the remote server, return the data from MSSQL to android code via JSON, insert into SQLite.
Edit: type MySQL to MSSQL
Get desired data from mysql ...in the form of xml from server. Parse that xml in android and fill desired java beans inside collection. then write state of object's in collection to sqlite dataabase.
I would suggest next time providing some code that indicates at least that you attempted to connect to your database first, and then if you run into trouble, someone here may be able to help. As opposed to just asking for sample code.
If you're talking about replication, I'm not sure this is possible from SQL Server to SQLite, otherwise, the answer to your question is simple, you would connect to your SQL Server database probably through some sort of exposed API, retrieve the data, parse it, and update your local SQLite Database accordingly.
Here's a link to a tutorial that covers connecting to local databases: NotePad Tutorial