使用soap将mysql转至android

发布于 2024-10-02 06:44:09 字数 127 浏览 0 评论 0原文

我很清楚android不支持mysql 但我需要连接 mysql 并从我研究的数据库中获取信息,

有 SOAP 和 REST 服务可以从 android 连接 mysql 有可能吗?然后给我一个想法,如果可能的话请举个例子

i know very well that android not support the mysql
but i need to connect mysql and get the information from database

i studied there are SOAP and REST services to connect mysql from android
is it possible?then give me one idea and if possible one example pls

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

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

发布评论

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

评论(2

我不吻晚风 2024-10-09 06:44:09

我需要连接mysql并获取
来自数据库的信息

您可以在连接或不连接数据库的情况下从数据库获取数据。您可以使用或不使用 SOAP 来获取它。服务器上的代理(通常是 CGI 脚本)代表客户端发出数据库请求。在 SOAP 中,查询和响应通常以 XML 进行编码,并且始终通过标准 Internet 方法(例如 HTTP 或 SMTP)进行传输。

非 SOAP 方法包括 CORBA、简单 RPC 和自行开发的解决方案。如果数据库对 Internet 开放,则可以直接连接到服务器上的数据库端口。

只有安全限制限制了您的操作。在只能使用邮件、HTTP 和 FTP 的环境中,SOAP 是一个很好的协议。如果客户端实际上是一个 Web 浏览器,那么 AJAX 是理想的选择。

对于典型的数据请求,您只需知道服务器上的 URL(以及相关协议)即可查询数据。例如,使用 HTTP:

http://dataserer.example.com/chart_data.cgi?chart_num=2 

服务器端脚本 chart_data.cgi 读取查询(在本例中来自 GET 请求),从数据库检索信息并将其以 XML 编码发送回到客户端,只需将 HTTP 标头和 XML 内容写入标准输出即可。 Javascript 和浏览器协议 XMLHttpRequest 使 HTML 请求和 XML 接收成为可能。

因此,即使在 Android 中,当您浏览网页并查看所有信息时,例如在亚马逊上。许多信息由亚马逊的代理从他们的数据库中检索,为客户端(Android 上的浏览​​器)格式化并发送回客户端。不需要 Android 特定的编码。

使用自定义远程代理(例如服务器上的 CGI 脚本)来访问远程数据库。 Android只需要与代理进行通信。

i need to connect mysql and get the
information from database

You can get the data from the database with or without connecting to it. You can get it with or without SOAP. An agent on the server, usually a CGI sript makes the database request on the client's behalf. In SOAP, the the query and response are often encoded in XML, and always transmitted by standard Internet methods such as HTTP or SMTP.

Non SOAP methods include CORBA, simple RPC, and home-grown solutions. If the database is open to the Internet, then a direct connection to the database port on the server is possible.

It's only the security restrictions that limit what you can do. In an environment where only mail, HTTP and FTP are possible, SOAP is a good protocol. If the client is actually a web browser, then AJAX is ideal.

For a typical data request, all you need to know is the URL (and associated protocol) on the server to query for the data. For example, using HTTP:

http://dataserer.example.com/chart_data.cgi?chart_num=2 

The server-side script, chart_data.cgi reads the query (from a GET request in this case), retrieves the information from the database and sends it, encoded in XML, back to the client, simply by writing the HTTTP header and XML content to standard output. It is Javascript and a browser protocol XMLHttpRequest that make the HTML request and XML receipt possible.

So even in Android, when you browse the web and see all that information, on Amazon for example. A lot of that information is retrieved by agents at Amazon from their database, formatted for the client(the browser on Android) and sent back to the client. No Android-specific coding is required.

Use a custom remote agent such as a CGI script on a server to access a remote database. Android only needs to communicate with the agent.

方觉久 2024-10-09 06:44:09

使用您选择的语言编写 SOAP 服务器:

调用来自Android:

当然,您不必在 SOAP 中执行此操作。您可以以任何格式(如 JSON、纯文本、XML、CSV(甚至 HTML?)...)从 Web 服务输出数据,并从 Android 中使用它。

Write a SOAP server using the language of your choice:

Call it from Android:

Of course, you don't have to do it in SOAP. You can just output the data from your web service in any format like JSON, plain text, XML, CSV, (or even HTML?) ... and consume it from Android.

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