简体   繁体   中英

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. How do I display the names of the database entries added in a android application. 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. 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.

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. 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. Thus it is not advised that you expose your MySQL server directly to the internet.

Best solution is to create a web services or service of sorts that your device connects to. This service then retrieves the data from the database and returns it to your device.

See this SO question for some more answers.

load the mysql driver in android emulator .

In my case I developed a simple Camel IP server that sits between my device and the MySQL database. 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.

Follow this tuto and you will learn how to do it exactly

Tuto Mysql/android

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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