Android是否可以在没有PHP的情况下直接连接到MySQL? [英] Can Android connect directly to MySQL without PHP?

查看:125
本文介绍了Android是否可以在没有PHP的情况下直接连接到MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 我想从android 连接到MySQL远程数据库,但是我不想将请求发送到php,我想直接连接到MySQL而无需向php发送请求,因此我认为会更快,我会从mysql远程数据库表中获得所需的一切,但就我而言,谷歌只提供有关如何通过请求连接到php的教程.甚至有可能做我想做的事吗?
  2. 如果无法使用第一个数据库,Android是否可以拥有本地数据库SQLite,可以在其中直接在android代码中将查询连接到该数据库,但是可以将android代码中的查询写到远程mysql数据库吗? li>
  1. I want to connect to MySQL remote database from android but I don't want to send request to php, I want a straight connection to MySQL without making request to php, so in my opinion it will be more fast and I will get everything i need from mysql remote db table, but as far as I google only tutorials on how to connect through request to php. Is it even possible to do what I want?
  2. If the first one isn't possible, could Android have local database SQLite in which straight away in android code I can wire queries to that db, but is it possible to write queries inside android code to remote mysql database?

推荐答案

强烈建议您不要这样做.

It is strongly recommended that you don't do this.

请参阅以下文章:在android中的mysql数据中直接插入数据

...以及这篇文章:

... and this post: Why should a developer use web services instead of direct connections to a db?

编辑:@ halfer的评论非常有用,因此请在此处引用:

Edit: The comment from @halfer is very informative, so quoting it here:

实际上,与MySQL相比,您将始终需要更多的安全控件 会给您-因此需要服务器端层.如果得到 速度慢,那么您可以优化查询或升级硬件(但 除非需要,否则不要进行优化.

In practice, you will always need more security controls than MySQL will give you - hence the need for a server-side layer. If it gets slow then you can optimise your queries or upgrade your hardware (but don't optimise unless you need to).

这篇关于Android是否可以在没有PHP的情况下直接连接到MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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