我们可以使用JDBC在Android的远程连接MySQL数据库?可以使用、数据库、Android、JDBC

2023-09-12 08:08:22 作者:善變的男人

我开发这需要远程数据库连接的客户端 - 服务器应用程序。

I am developing a client-server application which requires remote database connection.

我知道,在网络上与更多的人教程使用PHP与MySQL进行交互。但是,我不是在PHP的这么好,我以前的经验是核心的Java,Swing和JDBC。

I know that tutorials on the web and more people are using PHP to interact with MySQL. But, I am not so good at PHP and my prior experience is with Core Java, Swing and JDBC.

任何人都可以指导我是否可以使用JAVA JDBC的API在Android应用程序来连接远程MySQL数据库?

Can anyone guide me if it is possible to connect remote MySQL database using JAVA JDBC APIs in Android application?

推荐答案

您不能访问MySQL数据库从Android的原生。编辑:其实你可以使用JDBC,但不推荐(或可能不工作?)......看到Android JDBC不工作:ClassNotFoundException的驾驶员

You can't access a MySQL DB from Android natively. Actually you may be able to use JDBC, but it is not recommended (or may not work?) ... see Android JDBC not working: ClassNotFoundException on driver

请参阅

http://www.helloandroid.com/tutorials/connecting-mysql-database

http://www.basic4ppc.com/forum/basic4android-getting-started-tutorials/8339-connect-android-mysql-database-tutorial.html

Android无法直接连接到数据库服务器。因此,我们   需要创建一个简单的Web服务,将传递请求到   数据库将返回的响应。

Android cannot connect directly to the database server. Therefore we need to create a simple web service that will pass the requests to the database and will return the response.

HTTP://$c$concloud.blogspot。 COM / 2012/03 / Android系统的mysql-client.html

对于大多数[好]的用户,这可能是罚款。但是想象一下,你会得到一个黑客,获取一抱你的程序。我反编译我自己的应用程序和它的可怕我所看到的。如果他们得到您的用户名/密码到您的数据库和肆虐?坏的。

For most [good] users this might be fine. But imagine you get a hacker that gets a hold of your program. I've decompiled my own applications and its scary what I've seen. What if they get your username / password to your database and wreak havoc? Bad.