Guest User

Untitled

a guest
Jun 19th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. try {
  2. String path = "ruta_donde_repaldar"
  3. Runtime r = Runtime.getRuntime();
  4.  
  5. //PostgreSQL variables
  6. String user = "postgres";
  7. String dbase = "base_datos";
  8. String password = "tu_clave";
  9. Process p;
  10. ProcessBuilder pb;
  11.  
  12. /**
  13. * Ejecucion del proceso de respaldo
  14. */
  15. r = Runtime.getRuntime();
  16. pb = new ProcessBuilder("pg_dump", "-v", "-D", "-f", path, "-U", user, dbase);
  17. pb.environment().put("PGPASSWORD", password);
  18. pb.redirectErrorStream(true);
  19. p = pb.start();
  20.  
  21. } catch (Exception e) {
  22. }
Add Comment
Please, Sign In to add comment