Ver Mensaje Individual
  #4 (permalink)  
Antiguo 02/08/2012, 13:15
orlando1091
 
Fecha de Ingreso: noviembre-2011
Mensajes: 7
Antigüedad: 12 años, 5 meses
Puntos: 0
Respuesta: message from server:"Host 'localhost' is not allowed to connect to this My

prueba de esta forma

private String tipoDriver = "com.mysql.jdbc.Driver";
private String cadenaConexion;
private String usuarioRoot = "root";
private String claveRoot = "pass";

Connection conexionBD = null;

cadenaConexion = "jdbc:mysql://localhost:3306/proyecto";

String mensajeRespuesta = "No conectado...";

try {
Class.forName(this.tipoDriver);
conexionBD =
DriverManager.getConnection(this.cadenaConexion,
usuarioRoot, claveRoot);
}
}
catch (Exception e) {
mensajeRespuesta = "Ha ocurrido el siguiente error: \n" +
e.getMessage();
}
finally {
try {
conexionBD.close();
} catch (SQLException ex) {
mensajeRespuesta = "Ha ocurrido el siguiente error: \n" +
ex.getMessage();

}
}
conexionBD = null;