error to connect a DB
Hi, I need help with my problem:
Simply I have a java class (made with Eclipse) where .
In the main method I call to the constructor where I try to connect with a MySQL Data Base, this is my code, and my exception:
package es;
import java.lang.reflect.InvocationTargetException;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
.....
publicclass MyConnection{
Connection dbconn;
ResultSet results;
PreparedStatement sql;
public MyConnection(){
try
{
Class.forName("org.gjt.mm.mysql.Driver");
try{
dbconn = DriverManager.getConnection("jdbc:mysql://localhost:3306/paleodbtemp?user=root&password=123456");
}catch (SQLException s)
{
System.out.println("Error conexion DB: "+s);
}
}catch (ClassNotFoundException err)
{
System.out.println("Class loading error: "+err);
}
}
....
publicstaticvoid main(String[] args){
new MyConnection();
....
}
}
The Exception is:
Error conexion DB: java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306?
Why this error?

