title: Psql script not committing when executed from Java
body: <p>I have a .bat file that executes the psql command to import a SQL script file. When I execute the .bat file from Windows command line, it executes correctly. But when I call the .bat file from Java (with ProcessBuilder), the script doesn't end. I'm not getting any errors, not in the InputStream, the ErrorStream not even in the DB (Postgresql) log.</p>
  
  <pre><code>ArrayList&lt;String&gt; cmdArgs2 = new ArrayList&lt;String&gt;();
          cmdArgs2.add("sql2dbs.bat");
  
  
          ProcessBuilder pb2 = new ProcessBuilder(cmdArgs2);
          logger.info(pb2.command().toString());
  
          Map&lt;String, String&gt; env = pb2.environment();
          env.put("PGPASSWORD", "user");
  
          Process p2 = pb2.start();
  
          BufferedReader stdError2 = new BufferedReader(new InputStreamReader(p2.getErrorStream()));
          String s;
          while ((s = stdError2.readLine()) != null) {
              logger.info(s);
          }
  
          BufferedReader stdIn = new BufferedReader(new InputStreamReader(p2.getInputStream()));
          while ((s = stdIn.readLine()) != null) {
              logger.info(s);
          }
  
          p2.waitFor();
  </code></pre>
  
  <p>The SQL script is very long that's why I'm not adding it. The script does have a COMMIT statement at the bottom.</p>
  
  <p>Any ideas? Thanks, </p>