2

I am currently developing an android app and I am going to use MYSQL so the app can upload and download information. Basically, the app has a secure login process. In order to login, the user must create an account, which consists of username, email, password. Then users can upload and download both text and pictures to and from the server.

What are the pros and cons of using JDBC and a Webservice to connect to a DB in a mobile app? What are the differences between them?

Off the top of my head, my two main concerns are which one is better for efficiency (time and bandwidth) and security?

4

1 回答 1

2

永远不要使用来自远程设备的 JDBC 连接来连接服务器上的数据库!这是不安全的方式,因为您没有真正的方法来控制发送到数据库服务器的语句。

我也永远不会将数据库服务器直接暴露给 Internet 以接受 JDBC 连接,无论是来自移动设备还是常规桌面应用程序。

编辑:

这是对以下评论的回应:

谁说只有移动应用程序可以连接?使用数据包嗅探器查找 JDBC 连接的连接参数,您可以从命令行进行连接。然后你可以发送你想要的任何 SQL 语句。您可以尝试攻击数据库以获得管理员访问权限,您可以尝试查询数据库的元数据(表、列等),然后使用该信息窃取其他用户的登录数据......

如果您在两者之间有一个 Web 服务,那么它也可能会受到攻击,但是没有办法直接攻击您的数据库。

于 2013-11-05T10:03:34.940 回答