- I want to connect to MySQL remote database from android but I don't want to send request to php, I want a straight connection to MySQL without making request to php, so in my opinion it will be more fast and I will get everything i need from mysql remote db table, but as far as I google only tutorials on how to connect through request to php. Is it even possible to do what I want?
- If the first one isn't possible, could Android have local database SQLite in which straight away in android code I can wire queries to that db, but is it possible to write queries inside android code to remote mysql database?
Asked
Active
Viewed 1.8k times
6

halfer
- 19,824
- 17
- 99
- 186

Vladimir Arevshatyan
- 173
- 1
- 2
- 10
-
NO NEED TO SHOUT, we have **markup** on this site. You should also leave out thanks and non-question related material: no distractions, no chit-chat (read [help→tour](http://stackoverflow.com/tour)): – Anthon Mar 14 '15 at 07:40
-
1In practice, you will always need more security controls than MySQL will give you - hence the need for a server-side layer. If it gets slow then you can optimise your queries or upgrade your hardware (but don't optimise unless you need to). – halfer Mar 14 '15 at 08:47
-
@halfer After re-visiting this question, I realized that your comment was more of an answer than the one I had posted! I just quoted your comment in the answer so that it doesn't get lost. Hope that's ok, if not just roll it back. Cheers! – Daniel Nugent Nov 11 '15 at 18:46
-
1No worries @Daniel, that's fine `:-)`. – halfer Nov 11 '15 at 19:12
-
Yes, of course you can. In this article you could find info about [how to connect to MySQL in Android without PHP](https://medium.com/@joseds./xampp-db-connection-with-android-e7b682fc699c) – JoséDS Aug 02 '20 at 19:18
-
check https://stackoverflow.com/questions/25044910/how-to-make-mysql-connector-j-working-on-android – YoussefDir Oct 22 '20 at 09:25
2 Answers
2
It is strongly recommended that you don't do this.
See this post: Direct insert data in mysql data in android
... and this post: Why should a developer use web services instead of direct connections to a db?
Edit: The comment from @halfer is very informative, so quoting it here:
In practice, you will always need more security controls than MySQL will give you - hence the need for a server-side layer. If it gets slow then you can optimise your queries or upgrade your hardware (but don't optimise unless you need to).

Community
- 1
- 1

Daniel Nugent
- 43,104
- 15
- 109
- 137
-
1based on your answer and the link you've included, i think you should study more what is the difference between an answer and an advise – stackunderflow Mar 26 '18 at 18:32