I am getting an error Communication failure during handshake. Is there a server running on localhost:3306? i have written a jdbc program using type 4 jdbc driver and i want to perform a delete operation and the ide is eclipse. code:
Class.forName("com.mysql.jdbc.Driver");
String cs="jdbc:mysql://localhost:3306/account_db";
Connection con=DriverManager.getConnection(cs,"root",<password>);
PreparedStatement ps=con.prepareStatement("delete from empde emp_id=?");
Scanner s=new Scanner(System.in);
while(true)
{
System.out.println("enter the emp_id :");
int ac_id=s.nextInt();
ps.setInt(1,emp_id);
ps.executeUpdate();
System.out.println("one emp_id is deleted:");
System.out.println("one more emp_id?(yes/no)");
String choice=s.next();
if(choice.equals("no"))
System.out.println("empde is exit");
break;
}
ps.close();
con.close();
Error detected:
java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306? at com.mysql.jdbc.MysqlIO.init(Unknown Source)