code: public int getPort() {
          String hostAndPort = hostAndPort();
          int indexOfMaohao = hostAndPort.indexOf(":");
          if (indexOfMaohao == -1) {
              return 3306;
          } else {
              return Integer.parseInt(hostAndPort.substring(indexOfMaohao + 1));
          }
      }
docs: parse the database url and get the port.
  
  @return the port