Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group