public static List<String> getSpectrumNameByName(String name, String match) throws SQLException {
    LOGGER.info("name   "+ name);
    LOGGER.info("match  "+ match);
    List<String> result = new ArrayList<>();
    StringBuilder sql = new StringBuilder("select NAME, ID from SPECTRUM");

    if (name != null && !"".equals(name)) {
      sql.append("  where NAME ");
      // JavaDB does not support left() and instr(). we need change table structure.
      // devide name column by ';' . 
//      sql.append("  where left(NAME,instr(NAME,';')-1) ");
      if (match == null) {
        sql.append("= ?");
      } else {
        sql.append("like ?");
      }
    }
//    sql.append("  limit 20");
    LOGGER.info(sql);
    try (PreparedStatement ps = conn.prepareStatement(sql.toString())) {


      if ("both".equals(match)) {
        ps.setString(1, "%" + name + "%");
//        sql.append("like '%$name%'");
      } else if ("start".equals(match)) {
        ps.setString(1, "%" + name );
        // $sql .= "like '\%$name'";
//        sql.append("like '%$name'");
      } else if ("end".equals(match)) {
        ps.setString(1,  name + "%");
//        sql.append("like '$name%'");
        // $sql .= "like '$name\%'";
      } else   if (name != null && !name.isEmpty()) {
        ps.setString(1,  name );
        // $sql .= "='$name'";
      }

      
      
      
      
      ResultSet rs = ps.executeQuery();
      while (rs.next()) {
        result.add(String.format("%s\t%s\t0", rs.getString(1), rs.getString(2) ));
      }
    }
    return result;
  }