Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/03/2010, 23:47
Judgement
 
Fecha de Ingreso: noviembre-2008
Mensajes: 136
Antigüedad: 15 años, 6 meses
Puntos: 2
Mensaje Java MySQL Communications link failure

Saludos, tengo una maquina virtual ejecutando debian lenny, en esta tengo un servidor LAMP, en el cual ejecuto wordpress. Aqui he creado una base de datos llamada "agendita" y trato sin exito, conectarme por medio de java.

La dirección del servidor es 192.168.1.100, el firewall de windows esta desactivado

Este es el código que utilizo para tratar de conectarme, es el código genérico que he visto en varios sitios:

Código java:
Ver original
  1. public static void sqlTest(){
  2.  
  3.         String db = "agendita";
  4.         String login = "root";
  5.         String password = "1234";
  6.         String url = "jdbc:mysql://192.168.1.100:3306/" + db;
  7.  
  8.         Connection con = null;
  9.  
  10.         try{
  11.  
  12.             Class.forName("com.mysql.jdbc.Driver");
  13.             con = DriverManager.getConnection(url,login, password);
  14.  
  15.             if (con != null){
  16.  
  17.                 System.out.println("Conexion a base de datos " + url + "...Ok");
  18.                 con.close();
  19.  
  20.             }
  21.  
  22.         }catch(SQLException ex){
  23.  
  24.             System.out.println("SQLException : " + ex.getMessage());
  25.             System.out.println("SQLState : " + ex.getSQLState());
  26.             System.out.println("VendorError : " + ex.getErrorCode());
  27.  
  28.         }catch(ClassNotFoundException ex){
  29.  
  30.             System.out.println(ex);
  31.  
  32.         }
  33.     }

Este es el error que me muestra al correr el código:

Cita:
SQLException : Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
SQLState : 08S01
VendorError : 0
Muchas Gracias por su ayuda