code: public static String extractDatabaseName(String url) {
          int leftIndex = url.lastIndexOf("/");
          if (leftIndex == -1) {
              leftIndex = url.lastIndexOf(":");
          }
          leftIndex++;
  
          int rightIndex = url.length();
          if (url.contains("?")) {
              rightIndex = url.indexOf("?");
          } else if (url.contains(";")) {
              rightIndex = url.indexOf(";");
          }
          return url.substring(leftIndex, rightIndex);
      }
docs: TODO: man, this is ugly - igor