I tried to connect my Database on my virtual Server (Debian10) with a Java program on my computer (Windows 10). I tried this:
String url = "jdbc:mysql://xyz.de:3306/xyz? useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezon
e=Europe/Berlin";
String user = "xyz";
String password = "xyz";
try(Connection conn = DriverManager.getConnection(url, user,
password)) {
System.out.println("Successfully connected to database.");
}catch(SQLException ex) {
System.err.println(ex.getMessage());
}
And the error ist:
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not
received any packets from the server.
I created the user with "phpMyAdmin" and I gave it all permissions. And in the hostname field, I entered a "%";) I also activated the port on the server.
Thanks for Help :)