(need advice) Talk to the MySQL server database from my Android application

I am starting my thesis, which is an Android application. This application is based on the web platform that I created.

The part where I need a consultation is the most efficient way to pull data from a MySQL server into an application. Please give me some advice and your experience on this.

(I read about query coding in json, but it seems like an awful lot of unnecessary work)

+6
source share
2 answers

I suggest you use the RESTful Web Service in Java using Jersey as an intermediate layer between your Android application and the MySQL server. You can transfer data in JSON (my proposal for a mobile application), xml or palin text to your Android application.

You can find the benefits of using the web service on your system in the @Elad answer: Best way to access a remote database: through webservice or direct access to DB?

Also, if you decide to develop a different smartphone platform for your system, you just need to reuse the same web service. As a result, this web service can be considered as a common protocol for the mobile user of your system.

I used Hibernate to map data to a MySQL database. RESTful service using hibernation hosiery

If you decide to follow this approach, please note that it is highly recommended that you share your hibernation items with your services in Jersey. You need to connect the DAO to your Service Level. look what @Rick Mangi wrote to me: REST with Java (JAX-RS) using jersey and sleep mode

This is also a good approach to use the HTTP client in your Android application, as it supports the @GET, @POST, @DELETE and @PUT commands, and you can easily talk to your database, for example HTTP GET Request

+7
source

It’s possible using the Java Java Connector and directly connect to the server through port 3306 using the Java JDBC connector as the Jar library imported into your Android project, as shown here , as well as on a recent blog .

+3
source

Source: https://habr.com/ru/post/922843/


All Articles