I have a problem when I try to connect to a MySQL database. I am using MAMP on mac (local). My database name is "Hopital". Here is my function for the connection:
public Connexion(){
try{
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver ok");
String url = "jdbc:mysql://localhost:8888/Hopital";
String user = "root";
String password = "root";
Connection cn = DriverManager.getConnection(url, user, password);
System.out.println("Connexion ok !");
}catch(Exception e){
e.printStackTrace():}
The thing is that I have no error but my output is only "Driver ok", the other print doesn't work so I guess that the connection is not working.