code: public static int getFieldIndex(ResultSetMetaData resultSetMetaData, String fieldName) throws SQLException {
          for(int columnId = 1; columnId <= resultSetMetaData.getColumnCount(); columnId++) {
              if(fieldName.equalsIgnoreCase(resultSetMetaData.getColumnName(columnId))) {
                  return columnId;
              }
          }
          return -1;
      }
docs: Fetch the metadata, and check field name
  @param resultSetMetaData Active result set meta data.
  @param fieldName Field name, ignore case
  @return The field index [1-n]; -1 if the field is not found
  @throws SQLException