Re: pg_dump in PostgreSQL version 8.2 not working in Java app
От | Michael Schmidt |
---|---|
Тема | Re: pg_dump in PostgreSQL version 8.2 not working in Java app |
Дата | |
Msg-id | BAY114-DAV5F7BE8474EF1A0F69D51FA3AE0@phx.gbl обсуждение исходный текст |
Ответ на | pg_dump in PostgreSQL version 8.2 not working in Java app ("Michael Schmidt" <michaelmschmidt@msn.com>) |
Список | pgsql-jdbc |
Folks,
I've continued working on this problem and the plot thickens. I'm not even able to get output from psql.exe through Java. I ran the following simple test code:
// String[] parms = new String[] {"C:\\Windows\\System32\\ipconfig.exe", ""};
String[] parms = new String[]{"C:\\Program Files\\PostgreSQL\\8.2\\bin\\psql.exe","-Upostgres"};
File f = new File(parms[0]);
if (!f.isFile()) {
System.out.println("Error - this isn't a file");
}
ProcessBuilder pb = new ProcessBuilder(parms);
pb.redirectErrorStream(true);
Process p = pb.start();
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
System.out.println("Exit with " + p.exitValue());
The ipconfig utility simply outputs the internet configuration. I used the "" String to simulate a parameter. This code identifies parm[0] as a valid file, outputs the configuration, and returns an exit code of 0, as it should. When I switch the parms (comment out the ipconfig String[] line and remove the comments from the psql.exe String[] line), the process hangs. So, with identical code, ipconfig works and psql hangs. What the hey? And again, this did not happen with 8.1.
Michael Schmidt
В списке pgsql-jdbc по дате отправления: