public String eliminarImagenes(
      Connection conn,
      String pagina,
      String sucID,
      String vigID,
      String padreID,
      String secundarioID,
      String referenciaID,
      String documentoID,
      String consecutivoID) {
    String sql = "";
    Statement stmt = null;
    UtilidadesDatos ud = new UtilidadesDatos();
    try {
      if (consecutivoID.length() <= 0) consecutivoID = "1";

      if (pagina.equalsIgnoreCase("prerequisitodet")) {
        sql =
            "delete from COT_PREREQUISITODETIMG "
                + "where SUC_ID = '"
                + sucID
                + "'"
                + " and  VIG_ID = '"
                + vigID
                + "'"
                + " and  PREC_ID = '"
                + padreID
                + "'"
                + " and  TPR_ID = '"
                + secundarioID
                + "'"
                + " and  TDO_REFERENCIA = '"
                + referenciaID
                + "'"
                + " and TDO_ID = '"
                + documentoID
                + "'"
                + " and PREDI_CONSECUTIVO = '"
                + consecutivoID
                + "'";
      }
      if (pagina.equalsIgnoreCase("requisitosdis")) {
        sql =
            "delete from COT_REQHABILITANTEDISIMG "
                + "where SUC_ID = '"
                + sucID
                + "'"
                + " and  VIG_ID = '"
                + vigID
                + "'"
                + " and  DISC_ID = '"
                + padreID
                + "'"
                + " and  TDO_REFERENCIA = '"
                + referenciaID
                + "'"
                + " and TDO_ID = '"
                + documentoID
                + "'"
                + " and REDII_CONSECUTIVO = '"
                + consecutivoID
                + "'";
      }
      if (pagina.equalsIgnoreCase("proceso")) {
        sql =
            "delete from COT_PROCESOESTIMG "
                + "where SUC_ID = '"
                + sucID
                + "'"
                + " and  VIG_ID = '"
                + vigID
                + "'"
                + " and  PROC_ID = '"
                + padreID
                + "'"
                + " and  EPO_ID like '"
                + secundarioID
                + "'"
                + " and  TDO_REFERENCIA like '"
                + referenciaID
                + "'"
                + " and TDO_ID like '"
                + documentoID
                + "'"
                + " and PROEI_CONSECUTIVO like '"
                + consecutivoID
                + "'";
      }
      stmt = conn.createStatement();
      stmt.executeUpdate(sql);
      stmt.close();
      return "Ok";
    } catch (Exception e) {
      System.out.println("" + e.toString());
      return e.toString();
    } finally {
      try {
        stmt.close();
        stmt = null;
      } catch (Exception err) {;
      }
    }
  }
 public String consultarImagen(
     Connection conn,
     String path,
     String pagina,
     String sucID,
     String vigID,
     String padreID,
     String secundarioID,
     String referenciaID,
     String documentoID,
     String consecutivoID) {
   Vector vRetornoImg = new Vector(1);
   Statement st = null;
   ResultSet rs = null;
   String sql = "";
   try {
     if (consecutivoID.length() <= 0) consecutivoID = "%";
     if (pagina.equalsIgnoreCase("prerequisitodet")) {
       sql =
           " select PREDI_IMAGEN img, PREDI_NOMBREIMAGEN nameimg"
               + " from COT_PREREQUISITODETIMG"
               + " where suc_id = '"
               + sucID
               + "' "
               + "   and vig_id = '"
               + vigID
               + "'"
               + "   and prec_id = '"
               + padreID
               + "'"
               + "   and tpr_id = '"
               + secundarioID
               + "'"
               + "   and tdo_referencia = '"
               + referenciaID
               + "'"
               + "   and tdo_id = '"
               + documentoID
               + "'"
               + "   and predi_consecutivo like '"
               + consecutivoID
               + "'";
     }
     if (pagina.equalsIgnoreCase("requisitosdis")) {
       sql =
           " select REDII_IMAGEN img, REDII_NOMBREIMAGEN nameimg"
               + " from COT_REQHABILITANTEDISIMG "
               + " where suc_id = '"
               + sucID
               + "' "
               + "   and vig_id = '"
               + vigID
               + "'"
               + "   and disc_id = '"
               + padreID
               + "'"
               + "   and tdo_referencia = '"
               + referenciaID
               + "'"
               + "   and tdo_id = '"
               + documentoID
               + "'";
     }
     if (pagina.equalsIgnoreCase("proceso")) {
       sql =
           " select PROEI_IMAGEN img, PROEI_NOMBREIMAGEN nameimg"
               + " from COT_PROCESOESTIMG "
               + " where suc_id = '"
               + sucID
               + "' "
               + "   and vig_id = '"
               + vigID
               + "'"
               + "   and proc_id = '"
               + padreID
               + "'"
               + "   and epo_id = '"
               + secundarioID
               + "'"
               + "   and tdo_referencia = '"
               + referenciaID
               + "'"
               + "   and tdo_id = '"
               + documentoID
               + "'"
               + "   and proei_consecutivo like '"
               + consecutivoID
               + "'";
     }
     st = conn.createStatement();
     rs = st.executeQuery(sql);
     if (rs.next()) {
       vRetornoImg.clear();
       vRetornoImg.addElement(rs.getBlob("img"));
       vRetornoImg.addElement(rs.getString("nameimg"));
       return famhn.upload.central.FileUpload.materializarImagen(path + "/", conn, vRetornoImg);
     }
     return "Pendiente";
   } catch (Exception e) {
     System.out.println("" + e.toString());
     return e.toString();
   } finally {
     try {
       rs.close();
       rs = null;
     } catch (Exception er) {;
     }
     try {
       st.close();
       st = null;
     } catch (Exception err) {;
     }
   }
 }