pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedRe; pg_dump from Java
3+ messages / 2 participants
[nested] [flat]
* Re; pg_dump from Java
@ 2006-04-10 03:28 Michael Schmidt <michaelmschmidt@msn.com>
2006-04-10 10:22 ` Re: Re; pg_dump from Java Markus Schaber <schabi@logix-tt.com>
0 siblings, 1 reply; 3+ messages in thread
From: Michael Schmidt @ 2006-04-10 03:28 UTC (permalink / raw)
To: pgsql-jdbc
Folks,
I've continued to work on the problem (stubbornness + free time is a deadly combination) and have gotten a solution others might find helpful. In Java 1.5 (5.0 per their new numbering) there is a new ProcessBuilder class. It is a different way to create a runtime process that allows setting environmental variables. Of particular interest is the redirectErrorStream() method, which does just that - combines stderr with stdin. This simplifies matters - allowing the use of just one BufferedReader and lo and behold - the Password: prompt showed up. You can't readLine() it, but nevertheless, it is accessible.
Later!
Michael Schmidt
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Re; pg_dump from Java
2006-04-10 03:28 Re; pg_dump from Java Michael Schmidt <michaelmschmidt@msn.com>
@ 2006-04-10 10:22 ` Markus Schaber <schabi@logix-tt.com>
2006-04-10 16:52 ` Re: Re; pg_dump from Java Michael Schmidt <michaelmschmidt@msn.com>
0 siblings, 1 reply; 3+ messages in thread
From: Markus Schaber @ 2006-04-10 10:22 UTC (permalink / raw)
To: Michael Schmidt <michaelmschmidt@msn.com>; +Cc: pgsql-jdbc
Hi, Michael,
Michael Schmidt wrote:
> I've continued to work on the problem (stubbornness + free time is a
> deadly combination) and have gotten a solution others might find
> helpful. In Java 1.5 (5.0 per their new numbering) there is a new
> ProcessBuilder class. It is a different way to create a runtime process
> that allows setting environmental variables.
Maybe you can also use the appropriate environmental variable to pass
the password to pg_dump, it should work for all libpq based applications¹.
http://www.postgresql.org/docs/8.1/interactive/libpq-envars.html
This should work even nicer than parsing stdout / stderr.
HTH,
Markus
¹ Exception is debian, they put wrappers into the path which don't
honour those variables, and do their own magic.
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Re; pg_dump from Java
2006-04-10 03:28 Re; pg_dump from Java Michael Schmidt <michaelmschmidt@msn.com>
2006-04-10 10:22 ` Re: Re; pg_dump from Java Markus Schaber <schabi@logix-tt.com>
@ 2006-04-10 16:52 ` Michael Schmidt <michaelmschmidt@msn.com>
0 siblings, 0 replies; 3+ messages in thread
From: Michael Schmidt @ 2006-04-10 16:52 UTC (permalink / raw)
To: Markus Schaber <schabi@logix-tt.com>; +Cc: pgsql-jdbc
Markus,
Thanks for the info about these environment variables - pretty handy stuff! However, it seems a possible drawback in using them is that they could compromise cross-platform compatibility. Also, there was mention that PGPASSWORD could pose security issues on some systems. As I have it set up now, the user enters the password into the application on the first database access and it is stored for the duration of the session only.
Michael Schmidt
> I've continued to work on the problem (stubbornness + free time is a
> deadly combination) and have gotten a solution others might find
> helpful. In Java 1.5 (5.0 per their new numbering) there is a new
> ProcessBuilder class. It is a different way to create a runtime process
> that allows setting environmental variables.
Maybe you can also use the appropriate environmental variable to pass
the password to pg_dump, it should work for all libpq based applications¹.
http://www.postgresql.org/docs/8.1/interactive/libpq-envars.html<http://www.postgresql.org/docs/8...;
This should work even nicer than parsing stdout / stderr.
HTH,
Markus
¹ Exception is debian, they put wrappers into the path which don't
honour those variables, and do their own magic.
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in EU! www.ffii.org<http://www.ffii.org/; www.nosoftwarepatents.org<http://www.nosoftwarepatents.org/;
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2006-04-10 16:52 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-04-10 03:28 Re; pg_dump from Java Michael Schmidt <michaelmschmidt@msn.com>
2006-04-10 10:22 ` Markus Schaber <schabi@logix-tt.com>
2006-04-10 16:52 ` Michael Schmidt <michaelmschmidt@msn.com>
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