I found similar problems with this but haven't found a solution yet. I am making a create account form with a mysql connection but when I try to click the create button, I have this error.
Here is my code for myConnection
import java.sql.Connection;
import java.sql.DriverManager;
public class myConnection {
public static Connection getConnection() {
Connection con = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost/javacontactsapp", "root", "");
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
return con;
}
}
Output when I changed it to ex.printStackTrace();
Connection con = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost/javacontactsapp", "root", "");
} catch (Exception ex) {
ex.printStackTrace();
}
return con;