Good I am having a problem with this program that I did it gives me this error and I have tried everything but nothing works, I am connected to the database but it does not work. Here the code:
package conectaBD;
import java.sql.*;
public class NewClass {
public static void main(String args []){
try{
Connection MyConnection= DriverManager.getConnection("jdbc:mysql://localhost:3306/patrones","root","");
Statement MyStatement= MyConnection.createStatement();
ResultSet MyResultSet = MyStatement.executeQuery("SELECT * FROM usuario2");
while(MyResultSet.next()){
System.out.println(MyResultSet.getString("id")+ " "
+ MyResultSet.getString("nombre") + " ");
}
}catch(Exception e){
System.out.println("NO CONECTA!!");
e.printStackT**texto en negrita**race();
}
}
}