&GT - ;实现客户端与其中的最佳方式;服务器16; - >在Android应用程序的数据库架构?应用程序、架构、客户端、方式

2023-09-12 09:52:44 作者:闲悠

我想提出一个Android应用程序。由于它是如此简单,我首先想到我可以简单地不再需要充当一个中间件服务器上的Java应用程序。我尝试直接连接到使用JDBC驱动程序的MySQL数据库,但我的程序崩溃,所以我不知道,如果Android的支持的JDBC驱动程序MySQL的。

所以,我想到的是如何实现的应用程序。基本上,应用程序写入从远程MySQL数据库的一些数据,并从远程MySQL数据库检索一些数据。

我连接到使用套接字的Java服务器程序(或通信的某些其他方法)?或者,我能实现从客户端应用程序直接连接到MySQL数据库?

解决方案   

我试图直接连接到   使用JDBC驱动程序的数据库   MySQL,但我的程序崩溃等等   我不知道,如果Android的支持的   JDBC驱动程序为MySQL。

永远永远永远永远不要使用数据库驱动程序通过互联网连接,任何数据库,任何平台,任何客户端,任何地方。这双去移动。数据库驱动程序专为局域网的运行,并不适用于片状/间歇性连接或高延迟。

  

我连接到一个Java服务器程序   使用套接字(或一些其他方法   通信)?

为什么GTA5一直在载入中进不去 求大家帮忙解答

有不必是爪哇。它只是要的东西设计用于在互联网上。由于金先生的意见建议,Web服务已经使用了这种大部分在过去十年中。对于Android,REST Web服务可能是最容易消耗,因为没有内置的SOAP或XML-RPC支持。但在Java,PHP或Perl或SNOBOL Web服务是否实现,是由你。

嗯,好吧,也许SNOBOL将不会是一个可行的选择。 : - )

I am making an Android application. Since it is so simple, I first thought I could simply eliminate the need for Java application on the server which acts as a middleware. I tried directly connecting to the database using the JDBC driver for MySQL but my program is crashing so I'm not sure if Android "supports" the JDBC driver for MySQL.

So I am thinking of how to implement the application. Basically the application writes some data from a remote MySQL database and retrieves some data from a remote MySQL database.

Do I connect to a Java server program using sockets (or some other method of communication)? Or could I implement a direct connection to the MySQL database from the client application?

解决方案

I tried directly connecting to the database using the JDBC driver for MySQL but my program is crashing so I'm not sure if Android "supports" the JDBC driver for MySQL.

Never never never use a database driver across an Internet connection, for any database, for any platform, for any client, anywhere. That goes double for mobile. Database drivers are designed for LAN operations and are not designed for flaky/intermittent connections or high latency.

Do I connect to a Java server program using sockets (or some other method of communication)?

It doesn't have to be Java. It just has to be something designed for use over the Internet. As Mr. King's comment suggests, Web services have been used for this for much of the past decade. For Android, REST Web services are probably the easiest to consume, since there is no built-in support for SOAP or XML-RPC. But whether the Web service is implemented in Java, or PHP, or Perl, or SNOBOL, is up to you.

Well, OK, perhaps SNOBOL won't be a viable option. :-)