0

i have an android app that writes data to a text file. The text file has the following contents

0.459, 0.957, 9.692,2014/05/11 12:40:027916020051941
0.536, 0.919, 9.577,2014/05/11 12:40:027916080051941

i would like to save the contents of this text file to a mysql table on a server. Can i do this from within the android app? i.e. load the textfile and save its contents on the server? please help

2 Answers2

0

You can do that easily. You will first need to set up your environment for working with MySql using the JDBC API which is described here: http://zetcode.com/db/mysqljava/ , you have to have Mysql server installed on your computer first. when you are connecting ok to the database you can do the following described here How to store .txt files MySQL database?.

Community
  • 1
  • 1
RedCH
  • 96
  • 1
  • 3
0

Send a POST Request from the android side to a script on your server side which fetches values from the POST request and inserts it into the MySQL Server.

Read from File : How To Read/Write String From A File In Android

Sending a post request in android : http://www.androidsnippets.com/executing-a-http-post-request-with-httpclient

insert into db using php on the server : http://www.tutorialspoint.com/php/mysql_insert_php.htm

Community
  • 1
  • 1
Shivam Verma
  • 7,973
  • 3
  • 26
  • 34