I am writing a mobile application that should receive data from MySQL.

What methods exist for connecting MySQL with Android, and which one is the most optimal?

For SQLite there is a class, and there is no class for working with remote DBMS?

Closed due to the fact that the issue is too common for participants Akina , Peter Samokhin , 0xdb , AivanF. , MSDN.WhiteKnight May 16, '18 at 11:36 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 2
    Write your API on the backend for the application. - Peter Samokhin
  • @ For example in PHP? Is this the only way? - danilshik
  • The most logical way. There are a lot of ways to write a backend, and php is far from the best option. - Peter Samokhin
  • @PeterSamokhin which one do you think is better? - danilshik
  • four
    In general, yes, the Android application can work directly with MySQL using jdbc. But it is EXTREMELY not recommended. If this is for labs or coursework, then it's fine, but in a real application you don’t need to do that. - Suvitruf

1 answer 1

To work with MySQL directly, you can use jdbc from the java.sql package.

But this is EXTREMELY RECOMMENDED due to security issues. If you are writing this for educational purposes, then it's fine, but in real applications you don’t need to do that. All ports for such systems should be closed and access should be carried out through specially written services.