title: Could not create connection to database server
body: <p>I'm developing an app for Android in Eclipse.
  My problem is that when I try to connect to my database in mysql from my Android Application i get an error</p>
  
  <p>03-13 21:25:55.296: W/System.err(1197): com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.</p>
  
  <p>I'm relative new with database connections and I dont know what I'm doing wrong</p>
  
  <p>I let you here some code </p>
  
  <pre><code>package com.example.login;
  
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
  
  public class ConectorDDBB {
  
  static String iP = "127.0.0.1";
  static String puerto = "3306";
  static String userDDBB = "bruno";
  static String passwordDDBB= "bruno1234";
  
  
  public boolean conectarDDBB(String user, String password){
      String conexionMySQL = "jdbc:mysql://"+ iP + ":" + puerto;
      Connection con = null;
      Boolean login = false;
      try {
          Class.forName("com.mysql.jdbc.Driver");
          con = DriverManager.getConnection(conexionMySQL, userDDBB, passwordDDBB);
  
          Statement st = con.createStatement();
          ResultSet rs = st.executeQuery("SELECT * FROM login"); 
  
          while (rs.next()){
              if (rs.getString("User").equals(user))
                  login = true;
          }
  
  
          con.close();
          st.close();
          rs.close();
  
      } catch (ClassNotFoundException e) {
          e.printStackTrace();
      } catch (SQLException e) {
          e.printStackTrace();
      }
      return login;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I have been create a database in mysql with a table called login
  All the parameters IP Port user and password are right... so i dont understand why i cant connect
  if someone could help me..
  than you very much in advance</p>