简体   繁体   English

连接到Mysql数据库-JDBC或PHP

[英]Connect to Mysql-Database - JDBC or PHP

I want to access my Mysql-Database in the App I want to share in the PlayStore later. 我想在稍后要在PlayStore中共享的应用程序中访问Mysql数据库。 But what is the best way to connect to this DB? 但是,连接到该数据库的最佳方法是什么? I use JDBC because it is very easy and I do not need any other things like PHP-scripts. 我使用JDBC是因为它非常容易,并且不需要PHP脚本之类的任何其他东西。

But if I use JDBC in my App I have to give this API the Credentials like DB-URL, username and password. 但是,如果我在应用程序中使用JDBC,则必须给该API提供凭据,例如DB-URL,用户名和密码。 If anyone would decompile the App he could see this credentials. 如果有人反编译该应用程序,则他可以看到此凭据。 So i wonder how you would connect safe to a DB via Android Apps. 因此,我想知道您如何通过Android Apps安全地将数据库连接到数据库。 Do i need to do it via PHP-Scripts which are on the server? 我需要通过服务器上的PHP脚本来执行此操作吗?

Thank you 谢谢

For security reasons i would not access a database without a server, because i dont like the idea of having the database directly connected to the internet. 出于安全原因,如果没有服务器,我将无法访问数据库,因为我不喜欢将数据库直接连接到Internet的想法。 Especially if you release your app in the stores. 特别是如果您在商店中发布您的应用程序。

Like you already said, create a application server and let that server query data and send it to your phones. 就像您已经说过的那样,创建一个应用服务器,并让该服务器查询数据并将其发送到您的手机。 You can use JDBC too. 您也可以使用JDBC。

That way other people are not able to break into your database. 这样,其他人将无法进入您的数据库。

It's technically possible thought. 从技术上讲这是可能的。 android jdbc Android jdbc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM