[英]I have names stored in mysql how do I display that information in my android app
I have names stored in my mysql database i created a table called users and when you login into my android app you can input data into that table. 我在我的mysql数据库中存储了名称,我创建了一个名为users的表,当您登录到我的android应用程序时,可以将数据输入该表中。 How do I display the names of the database entries added in a android application.
如何显示添加在android应用程序中的数据库条目的名称。 I want when I click on search users it to bring up the names added in the database.
我想在单击搜索用户时调出数据库中添加的名称。
In short you would need to load the mysql jdbc drivers into your android application. 简而言之,您需要将mysql jdbc驱动程序加载到android应用程序中。 I am not sure if this can be done.
我不确定是否可以做到。 Android does not support connecting to a MySQL server out of the box as far as I know.
据我所知,Android不支持直接连接到MySQL服务器。
If you could include the mysql drivers into your android application by adding the mysql jdbc drivers jar to the application you would need to expose your MySQL server directly to the internet for the Android device to able to communicate to the server directly. 如果您可以通过将mysql jdbc驱动程序jar添加到应用程序中,从而将mysql驱动程序包含在android应用程序中,则需要将MySQL服务器直接公开到Internet上,以使Android设备能够直接与该服务器通信。 NOTE By putting your MySQL server directly on the internet it is a open invite for hackers etc. to try and break into your database.
注意通过将您的MySQL服务器直接放在互联网上,这是黑客等的公开邀请,他们试图侵入您的数据库。 Thus it is not advised that you expose your MySQL server directly to the internet.
因此,建议您不要将MySQL服务器直接暴露给Internet。
Best solution is to create a web services or service of sorts that your device connects to. 最好的解决方案是创建设备连接到的Web服务或各种服务。 This service then retrieves the data from the database and returns it to your device.
然后,该服务从数据库中检索数据并将其返回到您的设备。
See this SO question for some more answers. 请参阅此SO问题以获取更多答案。
load the mysql driver in android emulator . 在android模拟器中加载mysql驱动程序 。
In my case I developed a simple Camel IP server that sits between my device and the MySQL database. 就我而言,我开发了一个简单的Camel IP服务器,该服务器位于我的设备和MySQL数据库之间。 I used google protocol buffers to create a very simple RPC protocol and then I could upload files and data to mysql via the service and then also download and display data from the MySQL server via the service.
我使用Google协议缓冲区创建了一个非常简单的RPC协议,然后可以通过该服务将文件和数据上传到mysql,然后还可以通过该服务从MySQL服务器下载并显示数据。
Follow this tuto and you will learn how to do it exactly 遵循此教程,您将学到确切的方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.