title: DriverManager.getConnection(); How can I determine whether the username/password is wrong or the Driver is not able to connect to the database?
body: <p>Here's my Code:</p>
  
  <pre><code>public static Connection connectToDataBase() throws SQLException {
      try {
          Class.forName("com.mysql.jdbc.Driver");
      } catch (final Exception e) {
          throw new RuntimeException("Driver failure");
      }
      connectionProperties = new Properties();
      connectionProperties.put("user", user);
      connectionProperties.put("password", passwor);
      datenbankverbindung = DriverManager.getConnection(link, connectionProperties);
      return connection;
  }
  </code></pre>
  
  <p>I'm connecting to the database, which works fine. But I want to know whether the login data are false or if there's a problem with the connection.</p>