Ver Mensaje Individual
  #5 (permalink)  
Antiguo 23/11/2014, 13:39
Avatar de AnGuisi
AnGuisi
 
Fecha de Ingreso: julio-2013
Ubicación: San Felipe - Yaracuy
Mensajes: 122
Antigüedad: 10 años, 9 meses
Puntos: 2
Respuesta: Barra de Progreso en Backup a Postgresql desde Java

Este es el método que realiza el backup:

Código Java:
Ver original
  1. public boolean generarBackup(String path) {
  2.         String ruta;
  3.         String hora = getHoraActual();
  4.         String fecha = getFechaActual();
  5.         try {
  6.             Runtime r;
  7.             //concatenar hora con nombre del backup
  8.            
  9.             ruta = path.replace("\\\\", "\\\\\\\\");
  10.            
  11.             //PostgreSQL variables            
  12.             String password = "12345";
  13.             Process p;
  14.             ProcessBuilder pb;
  15.  
  16.             r = Runtime.getRuntime();
  17.            
  18.             pb = new ProcessBuilder("C:\\Archivos de programa\\PostgreSQL\\9.3\\bin\\pg_dump.exe", "-i", "-h", "localhost", "-p", "5432", "-U", "postgres", "-F", "c", "-b", "-v", "-f", ruta, "ihavey");
  19.             //pb = new ProcessBuilder("/opt/PostgreSQL/9.3/bin/pg_dump", "-i", "-h", "localhost", "-p", "5432", "-U", "postgres", "-F", "c", "-b", "-v", "-f", ruta, "integrada");
  20.             pb.environment().put("PGPASSWORD", password);
  21.             pb.redirectErrorStream(true);
  22.             p = pb.start();
  23.             return true;
  24.         } catch (Exception e) {
  25.             JOptionPane.showMessageDialog(new JFrame(), e,
  26.                     "INFORMACION", JOptionPane.ERROR_MESSAGE);
  27.             return false;
  28.         }
  29.     }

En que lugar y como podría ir incrementando la JProgressBar?