Re: pg_dump in PostgreSQL version 8.2 not working in Java app

From: "Michael Schmidt" <michaelmschmidt(at)msn(dot)com>
To: "PostgreSQL JDBC" <pgsql-jdbc(at)postgresql(dot)org>, "Michael Schmidt" <michaelmschmidt(at)msn(dot)com>
Subject: Re: pg_dump in PostgreSQL version 8.2 not working in Java app
Date: 2007-01-22 05:44:26
Message-ID: BAY114-DAV5F7BE8474EF1A0F69D51FA3AE0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Michael Paesold 2007-01-22 09:16:22 Re: Synthesize support for Statement.getGeneratedKeys()?
Previous Message Ken Johanson 2007-01-22 05:09:58 Re: Synthesize support for Statement.getGeneratedKeys()?