1

I'm developing an app that inserts data into database without using any webservies. I've created a database on my notebook with MySQL workbench. I am able to insert data into the database using emulator, but I cannot insert data into the database using my phone. I have changed the path from

jdbc:mysql://10.0.2.2:3306/ with jdbc:mysql://xx.xx.xx.xx:3306/

xx.xx.xx.xx is from ipconfig of my localhost machine. I've tried again with emulator and I'm still able to insert data, but when I try with phone I cannot. What could be the reason?

ak52
  • 53
  • 1
  • 9

1 Answers1

0

You can't access a MySQL DB from Android natively. EDIT: Actually you may be able to use JDBC, but it is not recommended (or may not work?) ... see

Android cannot connect directly to the database server. Therefore we need to create a simple web service that will pass the requests to the database and will return the response.

See this tutorial:

Community
  • 1
  • 1
joselufo
  • 3,393
  • 3
  • 23
  • 37