How put the correct "url" for a getConnection with DriverManager?
===

I have 2 questions about connection on "mysql" database in an android application : 

1 - I try this url for the connection on a mysql database : jdbc:mysql://xx.xx.x.xxx/dbname" with xx.xx.x.xxx the IP adress of my server. The database "dbname" is managed by phpMyAdmin on this server.

But I have always the same error : "com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure"

I have the internet PERMISSION in my manifest.

The code :
    private void callSQL() {
    	java.sql.Connection laConnection;
    	java.sql.Statement transmission;
    	ResultSet leResultat;
    	
    	try {
    			Class.forName("com.mysql.jdbc.Driver").newInstance();
    			laConnection= DriverManager.getConnection("jdbc:mysql://xx.xx.x.xxx/dbname", "user", "passwrd");
    			
    			transmission = laConnection.createStatement();
    			leResultat= transmission.executeQuery("select * from Communes");
    			
    			while (leResultat.next()) {
    				System.out.println("Commune : "+ leResultat.getString("Nom"));
    			}
    	}catch(Exception e){
    		System.out.println(e);
    	}
    	
    }


2 - Otherwise I try another solution with a http request on a php page that connects to the database. This solution works well. But which one is the best way to use?

