Im trying to learn how to use the JDBC to connect a application to a mysql database.
Im using the Android Studio.
I downloaded \"mysql-connector-java-5.1.37\" f
I had the same issue and the problem was in the mysql-connector-java-5.1.37.jar file. I downloaded an older version (mysql-connector-java-3.0.17-ga-bin.jar) from here and worked like a charm.
To get the connection use:
Class.forName("com.mysql.jdbc.Driver").newInstance();
String connection = "jdbc:mysql://"+ your_ip + ":"+ your_port +"/"+ database_name;
conn = DriverManager.getConnection(connection, user, pass);
Just in case, don't forget to compile it in your build.gradle:
dependencies {
//other stuff
compile files('libs/mysql-connector-java-3.0.17-ga-bin.jar')
}
PD: This only works if you use the connection from and AsyncTask