连接到从Android的SQL服务器连接到、服务器、Android、SQL

2023-09-12 06:29:40 作者:我的巴掌和你的脸最配

我目前正在开发一个现场服务应用程序,将数据存储在Android设备上的本地SQLite数据库。在某些时候,通常在完成数据采集回合之后,本地SQLite数据库在服务器上被同步到远程SQL Server数据库,还我需要从SQL Server数据库更新一些地方的表。

I'm currently developing a Field-Service application that stores data in the local sqlite database on an android device. At some point, usually after completing the data collection rounds, the local sqlite db is to be synchronized to a remote sql server db on the server, also i need to update some local table from sql server db.

任何建议,如何能够实现或工程作为一个解决方案?甚至更好,是否有替代在这样的应用中的同步数据?

Any suggestions as to how this could be achieved or engineered as a solution? Or even better, are there alternatives to synchronizing data in such an application?

推荐答案

我认为最好是使用像Web服务或您自己的基于TCP的逻辑层为应用程序的中介这将连接到SQL Server并执行的请求,你applicatation。不要试图连接到您的SQL直接从Android的服务器。你可以写 使用HTTP服务器(或Web服务),然后对一些后台code调用从Android设备的code的方法。

I think that the best is using a intermediary like web services or your own TCP based logic layer for your application which would connect to SQL server and execute requests of your applicatation. Don't try to connect to your SQL server directly from Android. You can write some backend code on your server (or webservice) and then call those code methods from your android device using Http.

和也有很多主题的计算器喜欢你的:

And also there are many themes in stackoverflow like your:

如何将Android连接到数据库服务器 Connecting Android编写MS SQL SERVER 2008 How to connect Android to a database server Connecting android with MS SQL SERVER 2008

关于如何编写Web服务。这是一个大问题,你一定要选择技术,有非常多的库,框架和平台,帮助你简单地编写一个Web服务。你必须选择通信协议,它可能是SOAP,WSDL或者删除调用过程,也可能是其他地区的应用。如果您使用的Java堆栈,还有目前一些流行的框架:

About how to write web services. It's a big question, and you must choose technology, there are very many libraries, frameworks and platforms that help you to simply write a web service. You must choose communicating protocol, it may be SOAP, WSDL or maybe remove calling procedure, it may be rest application. If you use java stack, there are some popular frameworks at the moment:

的Apache CXF 的Spring Web服务 Axis2的 Apache CXF Spring Web Services Axis2

您可以从阅读开始什么是网络服务是:

You can start from reading what a web service is:

http://en.wikipedia.org/wiki/Web_service

还有一些链接其提供例如,从Android的访问Web服务的:

Also some links which provide example of accessing web services from android:

Step一步地从Android的访问Web服务 Android和SOAP Web服务 Accessing与Android REST风格的Web服务 Step by step to access web service from android Android and soap web services Accessing restfull web service with android