如何从Android应用程序连接到MySQL数据库? [英] How to connect to a MySQL Database from an Android App?

查看:1400
本文介绍了如何从Android应用程序连接到MySQL数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想连接到托管在同一台服务器从我的Andr​​oid应用程序在Tomcat服务器上,而无需使用PHP MySQL数据库。有没有办法做到这一点?我找到了一些解决方案,但都使用PHP。

I would like to connect to a MySQL Database hosted on the same server with a Tomcat Server from my Android App without using PHP. Is there any way to do this? I found some solutions but all use PHP.

我可以直接连接还是必须通过Web服务器来做到这一点?

Can I connect directly or do I have to do it through a Web server?

推荐答案

由于您是在Tomcat上运行我想访问该数据库将是编写处理应用程序和服务器之间的通信的Web服务的最佳途径。

Because you're running on Tomcat I imagine the best way to access the database would be to write a webservice that handles the communication between the app and the server.

web服务将被写入在Java中使用JSP Tomcat的运行。

The webservice will be written in Java to run on TomCat using JSP.

我猜你想直接与MySQL数据库进行通信(即运行在数据库中直接SQL命令),但我不认为你可以做到这一点(虽然从来没有尝试过,或看着它),我有一直是根据你所需要的服务器上的某些code坐其间的IM pression。

I'm guessing you're trying to communicate directly with the MySQL database (i.e. run SQL commands on the database directly) but I don't think you can do this (although never tried or looked into it), I have always been under the impression that you need some code on the server to sit inbetween.

这篇关于如何从Android应用程序连接到MySQL数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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