如何SQLite的数据库转移到Web服务器的Andr​​oid手机(Android版)上 [英] How to transfer SQLite db to web server on android phone (android)

查看:209
本文介绍了如何SQLite的数据库转移到Web服务器的Andr​​oid手机(Android版)上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SQLiteDatabaseBackUpContacts.db的数据库,它有一个名为的ContactInfo列名的ContactID名称,联系人姓名,MobilePhone1,MobilePhone2,OfficePhone1,OfficePhone2,OfficePhone3,HomePhone1,HomePhone2和TokenId表。

I have "BackUpContacts.db" database in SQLiteDatabase, it has a table named "ContactInfo" with column names ContactId, ContactName, MobilePhone1, MobilePhone2, OfficePhone1, OfficePhone2, OfficePhone3, HomePhone1, HomePhone2 and TokenId.

我要的是在某个服务器的ContactInfo表的所有数据转移到MySQL数据库系统(指服务器也有类似的ContactInfo,其中的ContactInfo的所有数据将被复制的表)。

What i want is to transfer all data of "ContactInfo" table to the mysql database system at some server (means server has also a table similar to "ContactInfo", where all data of "ContactInfo" will be copied).

我想最后一个重要的事情是,每当我想要得到的联系人(指定TokenId的)我可以备份所有这些从服务器到一个XML文件中的移动设备。

The last important thing which i want is that, whenever i want to get contacts(of a specified TokenId) i can backup all those from server to the mobile device in an xml file.

在短,可有人在这里帮助我如何sqlite的数据库传送到Web服务器?

in short, can here anyone help me how to transfer sqlite db to a web server?

推荐答案

一种方法是使用GET或POST方法,将它加入到MySQL的远程应用程序服务器上,像

One way is to submit data to your webiste's php page by using GET or POST method which will add it to MySql on your remote application server, like

    HttpGet request = new HttpGet(url); 
    ResponseHandler<String> responseHandler = new BasicResponseHandler();
    HttpClient client = new DefaultHttpClient();
    String response = client.execute(request, responseHandler);

URL可以是:www.mysite.com?id=5&name=john ...
这也必须是一个AsyncTask的doInBackground请求......
问题是多少记录可以一次上传...

url can be: www.mysite.com?id=5&name=john ... This also has to be an AsyncTask doInBackground request... The problem is how many records can be uploaded at once...

这容易使远程应用程序服务器上产生的请求XML文件由Android下载,使用像上面的类似要求。

It easy to make the remote application server produce an XML file on request to be downloaded by android, with a similar request like above.

这篇关于如何SQLite的数据库转移到Web服务器的Andr​​oid手机(Android版)上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆