It is impossible for some reason to connect to the database. Catch catches an exception.
public class Main { private static final String URL = "jdbc:mysql://localhost:3306/mydbtest?useSSL=false"; private static final String LOGIN = "root"; private static final String PASSWORD = "root"; public static void main(String[] args) { Connection connection = null; try { connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydbtest?useSSL=false", "root", "root"); if(!connection.isClosed()){ System.out.println("TRUE"); } } catch (SQLException e) { System.err.println("Невозможно подлючиться к БД!"); } } } 