code: private Connection getConnectionViaDriverMangaer(String driver, String url, String user, String password) {
  
          Connection conn = null;
          try {
              Class.forName(driver);
              conn = DriverManager.getConnection(url, user, password);
          } catch (ClassNotFoundException e) {
              e.printStackTrace();
          } catch (SQLException e) {
              e.printStackTrace();
          }
          return conn;
      }
docs: get connection object from driver manager
  
  @param url
  @param user
  @param password
  @return