Novice coder
Novice coder

Reputation: 163

How do I connect my Android app to a remote MySQL database?

I'm new to android app development.

Can I connect directly to a remote MySQL database?

If not, do I need to send a POST or GET request to a URL that'll handle the database instead?

Is it dangerous to connect directly to a remote MySQL database since you'd put the username and password in your code where anyone can see it?

Upvotes: 1

Views: 1049

Answers (1)

Jite
Jite

Reputation: 5847

It is possible to connect to a database remote from the application, but its not at all recommended.
Mainly because it would be very easy to sniff the traffic and possibly retrieve password and such for the server (as you guessed).
The best way (as you also mentioned) is usually to build some type of API that handles the database communication and then send requests to it from the phone.

Upvotes: 3

Related Questions