From: Michael Schmidt <michaelmschmidt@msn.com>
To: PostgreSQL JDBC <pgsql-jdbc@postgresql.org>
To: Michael Schmidt <michaelmschmidt@msn.com>
Subject: Re: pg_dump in PostgreSQL version 8.2 not working in Java app
Date: Sun, 21 Jan 2007 22:44:26 -0700
Message-ID: <BAY114-DAV5F7BE8474EF1A0F69D51FA3AE0@phx.gbl> (raw)
References: <BAY114-DAV114EEFC7F6023D640831B4A3A80@phx.gbl>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: michaelmschmidt@msn.com
Subject: Re: pg_dump in PostgreSQL version 8.2 not working in Java app
In-Reply-To: <BAY114-DAV5F7BE8474EF1A0F69D51FA3AE0@phx.gbl>
References: <BAY114-DAV114EEFC7F6023D640831B4A3A80@phx.gbl> <BAY114-DAV5F7BE8474EF1A0F69D51FA3AE0@phx.gbl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox