How to connect Android with MySQL using Mysql JDBC driver
Android by default does not support MySQL. It has an in-built database i.e SQLite.
If you are trying to access MySQL database remotely, you should expose interface to this database with any standard web service.
E.g you could create RESTful Web Service on Server Side which is written using Java/PHP etc. and MySQL Connector. (Which you have already done!)
And your Android App could talk to this service with the URL generated using this web service.
Again, this question has been repeated previously, so you can check those solutions.
android connect to mysql database directly using mysql-connector
You can't use second (jdbc) method with android application (SO Reference thread). You have to use REST API.
Using JDBC MySQL to connect database in Android?
Generally MySql is installed with security restrictions so it is possible to access to it only from localhost.
You need to execute a command similar to the following to permit access from other ip
GRANT ALL PRIVILEGES
ON database.*
TO 'youruser'@'%'
IDENTIFIED BY 'yourpassword';
Note that it is a bad practice to offer access to MySql from any IP because it opens the possibility to be hacked. So generally it is a good idea to place a server that intercept requests from your android application and directly call the database.
Note: check also if it is open the route between your application and the mysql server.
If you use 3G you are not using a local network and the IP of the MySql server is different from 192.168.1.xxx (that is the ip of a local network). It is also possible that outside of the local network the MySql Server is not visible. It depends from the configuration of your network.
You need to "open" your network exposing the port to access mysql and checking which is the ip of your local network as seen from internet. Otherwise you can access to the local network using a phone with wireless connection to your local network.
Connecting to MySQL from Android with JDBC
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 JDBC not working: ClassNotFoundException on driver
See
http://www.helloandroid.com/tutorials/connecting-mysql-database
http://www.basic4ppc.com/forum/basic4android-getting-started-tutorials/8339-connect-android-mysql-database-tutorial.html
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.
http://codeoncloud.blogspot.com/2012/03/android-mysql-client.html
For most [good] users this might be fine. But imagine you get a hacker that gets a hold of your program. I've decompiled my own applications and its scary what I've seen. What if they get your username / password to your database and wreak havoc? Bad.
Related Topics
How to Get String Array from Arrays.Xml File
Private Final Static Attribute VS Private Final Attribute
How to Programmatically Enable Gps in Android Cupcake
Androidruntime Error: Parcel: Unable to Marshal Value
How Apply CSS on a <H:Inputtext>
Add Custom CSS to HTML Code with Jsoup
Jackson Enum Serializing and Deserializer
How Do Hashtables Deal with Collisions
Getting Spring Application Context
Javafx - What Is This Weird Container That Holds Context Menu
Prevent Android Activity Dialog from Closing on Outside Touch
How to Change Webservice Url Endpoint
Aes Gets Different Results in iOS (Obj-C) and Android (Java)