如何从 MySql 服务器到 Android 应用程序?

发布于 2024-09-02 22:45:41 字数 182 浏览 3 评论 0原文

我有一个 MySql 数据库,里面有一些体育比赛结果。我想写一个Android应用程序来在手机上显示这些数据。

我在网上搜索过这个问题,我认为MySql数据库和Android应用程序之间不可能有直接连接。 (这是正确的吗?)

所以我的问题如下: 我怎样才能在android应用程序中访问MySql数据库以显示一些数据?

I have a MySql database with some sports results in it. I want to write an Android application to display these data on mobile phones.

I´ve searched on the internet for this issue, and I think it is not possible to have a direct connection between the MySql database and the Android application. (Is this right?)

So my question is the following:
How can I have access in the android application to the MySql database in order to display some of the data?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

浅笑依然 2024-09-09 22:45:41

尝试一下这个方法。我将在我正在进行的当前项目中使用这种方法。

您基本上在服务器上创建一个 php 脚本,并使用 http posts 将数据发送到脚本,请阅读下面链接的教程以获得更好的解释。

mysql/android 教程

Try this method out. I will be using this method for the current project i am working on.

You basically create a php script on a server and use http posts to send the data to the script, read the tutorial linked below for better explanation.

mysql/android tutorial

み零 2024-09-09 22:45:41

您可能想查看 C2DM (http://code.google.com/android/c2dm/)。

一种常见的方法是编写 REST Web 服务并让 Android 调用该服务并从服务器获取数据。

如果你想推送它,如果数据足够小,你可以使用短信,只需将数据作为文本消息发送到设备。

您不想开放对数据库的访问,因此通过使用 Web 服务可以更好地保护您的数据库。

You may want to look at C2DM (http://code.google.com/android/c2dm/).

A common way is to write a REST web service and have Android call that and get the data from the server.

If you want to push it, if the data is small enough, you could use SMS and just send the data as a text message to the device.

You don't want to open access to your database so by using the web service you can better protect your database.

雾里花 2024-09-09 22:45:41

有很多方法可以实现这一点,但我会使用 SOA。

您的移动应用程序需要遵循典型的面向服务的架构(SOA)并且
将需要三个不同的元素:外部数据库;网络服务;和移动网络服务客户端。

您将需要使用 Java EE 之类的东西创建一个 Web 服务,该服务接收来自本地安装的 Android 应用程序的请求,并使用来自外部 MySql 数据库的所需数据进行响应。

我使用 Android 库的 KSOAP 来执行此操作,但理想情况下应该使用 REST。

There are many approaches to this, but I would use an SOA.

Your mobile application will need to follow a typical service-oriented architecture (SOA) and
will need three distinct elements: an external database; a web-service; and a mobile web-service client.

You will need to create a web-service using something like Java EE that receives a request from the locally installed android application, and responds with the required data from the external MySql database.

I am using the KSOAP for android libraries to do this, but should ideally be using REST.

深白境迁sunset 2024-09-09 22:45:41

使用Mysql在本地计算机中使用android输入数据存储数据的分步过程

Android 连接到 MySQL、PHP

这是其中之一网上最简单的教程,涉及从 Android 应用程序到 PHP 脚本的数据流,然后最终存储在 MySQL 数据库中。

希望有帮助

Step by step procedure for using Mysql to store data in local machine using android to enter data

Android Connecting to MySQL, PHP

This is one of the simplest tutorials on the net regarding data flow from your Android app to PHP script then finally is stored in your MySQL database.

Hope it helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文