与远程数据库进行通信的PhoneGap应用 [英] PhoneGap application that communicate with a remote DB

查看:97
本文介绍了与远程数据库进行通信的PhoneGap应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的PhoneGap构建应用程序,它的一个Facebook风格的应用程序,的想法是,用户可以发布消息和他们的朋友可以在消息发表评论。 该应用程序基于HTML,JS和PhoneGap的。 我有一个MySQL数据库的服务器。 我的问题是我怎么能拉并从远程数据库推送数据。 我是个初学者,所以我真的不知道如何做到这一点。 我需要的页面,实时更新,甚至在他完成加载

I build phoneGap app, its a facebook-style app, the idea of the is that users can post messages and their friends can comment on the message. The app based on html, js and phoneGap. I have a server with a mysql database. My question is how can i pull and push a data from the remote DB. I'm a begginer so I not really sure how to do this. I need the page to be updated in real time, even after he finished loading

我GOOGLE了它,我意识到我需要为使用了Ajax,是真的吗? 谁能给我指点一下?

I Googled it and I realized I needed for that use Ajax, is that true? Can anyone give me guidance?

感谢:)

对不起我的英语水平。

推荐答案

我可以看到两种方法:

  • 实现自己的后台服务器,提供推,拉和通​​知服务。这个后端服务器会谈到你的数据库,并提供服务,这是可从JavaScript的(是的,很可能使用Ajax。需要注意的是阿贾克斯是一个概念,你需要选择一个实现,如jQuery的/ jqMobile框架提供的名称) 。对于速度和易用性,考虑一个平台提供商,如dotCloud.com,在那里你可以利用preconfigured服务器,并保持相同的编程语言/环境中(例如,使用的Node.js和dotCloud的MySQL服务)。

  • implement your own backend server that provides push, pull and notification services. This backend server talks to your database and provides services that are accessible from JavaScript (yes, probably using Ajax. Note that Ajax is a concept, and you will need to choose an implementation, such as the one provided by the jQuery/jqMobile frameworks). For speed and ease of use, consider a platform provider such as dotCloud.com, where you can leverage preconfigured servers and stay within the same programming language/environment (e.g. using Node.js and dotCloud's MySQL service).

使用提供开箱即用,如parse.com或deployd.com的后端数据服务器。这不仅为您提供了一个现成的框架和所有必要的接口进行远程数据存储和实时客户端更新,同时也可以确保您的应用程序扩展。

use a backend data server provided out of the box, such as parse.com or deployd.com. This not only gives you a ready framework and all the necessary interfaces for remote data storage and real time client updates, but also makes sure that your application will scale.

如果您想了解如何编写一个后端服务器的第一种方法更适合,但它会离开你的责任,使其安全性和可扩展性。

The first approach is better suited if you want to learn how to program a backend server, but it will leave you with the responsibility to make it secure and scalable.

第二个办法似乎更为合适,如果你不希望就如何建立和管理一个后台服务器微小的细节关心自己,但真正专注于让你的应用程序启动和运行。

The second approach seems more appropriate if you don't want to concern yourself with minute details on how to build and manage a backend server, but really concentrate on getting your app up and running.

BTW:我没有联系到任何平台或提及的产品,并简单地包括他们的名字作为例子。其他类似的产品可能存在,也许更合适,或有较少的商业后盾。

BTW: I have no affiliation to any of the platforms or products mentioned, and simply include their names as examples. Other similar offerings might exist that maybe more appropriate or have less of a commercial backing.

编辑:错别字,正确的域名

typos, correct domain names

这篇关于与远程数据库进行通信的PhoneGap应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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