Re: [HACKERS] Backup and restore through JDBC

2006-09-30 Thread Markus Schaber
Hi, Tom,

Tom Dunstan wrote:

 On a unix box, when you're really crazy, and want to ignore all security
 restrictions, you could even install pg_dump via inetd, and then
 everyone connecting via TCP on the appropriate port gets a dump of the
 database. :-)
 
 Oh, man, my head just exploded reading that. That's taking evil and
 being *creative* with it. :)

Well, combine that with some firewall / hosts.allow rules, and sslwrap
with certificate based 2-way authentication, if you insist on
security. :-)

Keep on lauging,
Markus
-- 
Markus Schaber | Logical TrackingTracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org



signature.asc
Description: OpenPGP digital signature


Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Albe Laurenz
Marlon Petry wrote:
 I am trying to develop, a API to carry through backup and 
 restore through JDBC.
 I think that the best form is to use JNI. 
 Some Suggestion? 

Do you mean 'backup' or 'export/dump'?
If you mean 'export', do you need anything besides SQL?
If you mean 'backup', how do you want to restore from
a client machine when there is no server running?
And if you're on the server, why would you want to use Java?

Yours,
Laurenz Albe

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Marlon Petry
The idea is to make one pg_dump of the server and to keep in the
machine of client.And to restore this pg_dump when it will be necessary
through the machine of the client.Perhaps I will have that to use some store procedure in the server, I do not know
 regardsMarlon2006/9/29, Albe Laurenz 

[EMAIL PROTECTED]:
Marlon Petry wrote: I am trying to develop, a API to carry through backup and restore through JDBC. I think that the best form is to use JNI. Some Suggestion?Do you mean 'backup' or 'export/dump'?
If you mean 'export', do you need anything besides SQL?If you mean 'backup', how do you want to restore froma client machine when there is no server running?And if you're on the server, why would you want to use Java?
Yours,Laurenz Albe-- MarlonA busca infinita à felicidade nos priva de vivê-la a cada dia... (Elba Lucas)




Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Andrew Dunstan

Marlon Petry wrote:


The idea is to make one pg_dump of the server and to keep in the 
machine of client.
And to restore this pg_dump when it will be necessary through the 
machine of the client.
Perhaps I will have that to use some store procedure in the server, I 
do not know





pg_dump and pg_restore do not need to run on the server machine. Why not 
just run them where you want the dump stored?


cheers

andrew

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Marlon Petry
 The idea is to make one pg_dump of the server and to keep in the
 machine of client. And to restore this pg_dump when it will be necessary through the machine of the client. Perhaps I will have that to use some store procedure in the server, I do not know
pg_dump and pg_restore do not need to run on the server machine. Why notjust run them where you want the dump stored?cheersandrewBut I would need to have installed pg_dump and pg_restore in machine client?
Without having installed pg_dump and pg_restore,how I could makeregards,Marlon


Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Andrew Dunstan

Marlon Petry wrote:



pg_dump and pg_restore do not need to run on the server machine.
Why not
just run them where you want the dump stored?




But I would need to have installed pg_dump and pg_restore in machine 
client?

Without having installed pg_dump and pg_restore,how I could make





You can't. pg_dump in particular embodies an enormous amount of 
knowledge that simply does not exist elsewhere. There is no dump/restore 
API, and there is nothing you can hook up to using JNI, AFAIK.


cheers

andrew


---(end of broadcast)---
TIP 4: Have you searched our list archives?

  http://archives.postgresql.org


Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Andreas Pflug
Andrew Dunstan wrote:
 Marlon Petry wrote:


 pg_dump and pg_restore do not need to run on the server machine.
 Why not
 just run them where you want the dump stored?




 But I would need to have installed pg_dump and pg_restore in machine
 client?
 Without having installed pg_dump and pg_restore,how I could make




 You can't. pg_dump in particular embodies an enormous amount of
 knowledge that simply does not exist elsewhere. There is no
 dump/restore API, and there is nothing you can hook up to using JNI,
 AFAIK.
Recently, there was the proposal to extract that knowledge to a library
(making pg_dump itself just a wrapper). This sounds valuable more and
more, is anybody working on this for 8.3?

Regards,
Andreas


---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Markus Schaber
Hi, Marlon,

Marlon Petry wrote:

 But I would need to have installed pg_dump and pg_restore in machine
 client?
 Without having installed pg_dump and pg_restore,how I could make

pg_dump and pg_restore should be runnable (possible with a small shell /
bash wrapper script) without any installation, simply having them and
all neded libs lying in the current directory. They don't need any
registry keys, weird environment settings or such, just some libs which
should be present on most platforms, except libpq.

Using a java application for dump/restore will burden you with
installing a JVM, the PostgreSQL JDBC drivers, and your application,
which seems at least equal effort and more ressources.


Btw, another idea is to run pg_dump on the server, but pipe its output
to the client, e. G. via running it through telnet or SSH (yes there are
SSH servers for windows), and then piping it to a file on the client (e.
G. using plink.exe from the putty package). Or use netcat or so.

On a unix box, when you're really crazy, and want to ignore all security
restrictions, you could even install pg_dump via inetd, and then
everyone connecting via TCP on the appropriate port gets a dump of the
database. :-)

HTH,
Markus
-- 
Markus Schaber | Logical TrackingTracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org




signature.asc
Description: OpenPGP digital signature


Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Marlon Petry
 Marlon Petry wrote:
 pg_dump and pg_restore do not need to run on the server machine. Why not just run them where you want the dump stored? But I would need to have installed pg_dump and pg_restore in machine
 client? Without having installed pg_dump and pg_restore,how I could make You can't. pg_dump in particular embodies an enormous amount of knowledge that simply does not exist elsewhere. There is no
 dump/restore API, and there is nothing you can hook up to using JNI, AFAIK.Recently, there was the proposal to extract that knowledge to a library(making pg_dump itself just a wrapper). This sounds valuable more and
more, is anybody working on this for 8.3?Regards,AndreasI have interest in working,how i could start ?regards,marlon


Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Andrew Dunstan

Marlon Petry wrote:


 You can't. pg_dump in particular embodies an enormous amount of
 knowledge that simply does not exist elsewhere. There is no
 dump/restore API, and there is nothing you can hook up to using JNI,
 AFAIK.
Recently, there was the proposal to extract that knowledge to a
library
(making pg_dump itself just a wrapper). This sounds valuable more and
more, is anybody working on this for 8.3?


I have interest in working,how i could start ?




Start by reading the code in src/bin/pg_dump

Then after you recover from your head exploding you start devising some 
sort of sane API ...


cheers

andrew

---(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


Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Marlon Petry
Marlon Petry wrote:  You can't. pg_dump in particular embodies an enormous amount of
  knowledge that simply does not exist elsewhere. There is no  dump/restore API, and there is nothing you can hook up to using JNI,  AFAIK. Recently, there was the proposal to extract that knowledge to a
 library (making pg_dump itself just a wrapper). This sounds valuable more and more, is anybody working on this for 8.3? I have interest in working,how i could start ?
Start by reading the code in src/bin/pg_dumpThen after you recover from your head exploding you start devising somesort of sane API ...cheersandrew
ok. i'm trying start.


Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Tom Dunstan

Markus Schaber wrote:

Marlon Petry wrote:

But I would need to have installed pg_dump and pg_restore in machine
client?
Without having installed pg_dump and pg_restore,how I could make


pg_dump and pg_restore should be runnable (possible with a small shell /
bash wrapper script) without any installation, simply having them and
all neded libs lying in the current directory.


There's probably a case for having static builds of pg_dump and 
pg_restore around for various architectures, if only to help people out 
when they don't have access to a build environment etc. Either a set of 
static binaries on the website, or an easy way to build them from the 
source tree (they could then be copied to the target system).


It strikes me that Marlon hasn't really explained why he wants to use 
JDBC. I assume that your application is Java based, but trust me, 
invoking pg_dump through Runtime.exec() or whatever is going to be much, 
much easier than any of the other things you've suggested, such as 
making a pg_dump API and using JNI to call it. That's just pain city, in 
a bunch of ways.


Do you need to process the dump inside your program in some way? Or do 
you just need to store a dump and restore it later? Why the fascination 
with using an API?



On a unix box, when you're really crazy, and want to ignore all security
restrictions, you could even install pg_dump via inetd, and then
everyone connecting via TCP on the appropriate port gets a dump of the
database. :-)


Oh, man, my head just exploded reading that. That's taking evil and 
being *creative* with it. :)


Cheers

Tom


---(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


Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Tom Lane
Andrew Dunstan [EMAIL PROTECTED] writes:
 Then after you recover from your head exploding you start devising some 
 sort of sane API ...

That's the hard part.  There is no percentage in having a library if
it doesn't do anything significantly different from what you could
accomplish via
system(pg_dump ...switches);

What is it you hope to accomplish by having a library, exactly?
(And don't say more control over the dump process.  pg_dump is already
on the hairy edge of maintainability; we do *not* need to try to deal
with making it still function correctly after an application programmer
makes some random intervention in the process.)

regards, tom lane

---(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


Re: [HACKERS] Backup and restore through JDBC

2006-09-29 Thread Andreas Pflug
Tom Lane wrote:
 Andrew Dunstan [EMAIL PROTECTED] writes:
   
 Then after you recover from your head exploding you start devising some 
 sort of sane API ...
 

 That's the hard part.  There is no percentage in having a library if
 it doesn't do anything significantly different from what you could
 accomplish via
   system(pg_dump ...switches);

 What is it you hope to accomplish by having a library, exactly?
 (And don't say more control over the dump process. 
Some more progress feedback would be really nice.
  pg_dump is already
 on the hairy edge of maintainability; we do *not* need to try to deal
 with making it still function correctly after an application programmer
 makes some random intervention in the process.)
   
Agreed. The only sane approach seems to have a single dump function call
(that takes a set of parameters as prepared by command line scanning)
and a set of callbacks that enable api users to do sensible stuff at
different stages of the backup process.

Regards,
Andreas





---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


[HACKERS] Backup and restore through JDBC

2006-09-28 Thread Marlon Petry
Hello List
I am trying to develop, a API to carry through backup and restore
through JDBC.
I think that the best form is to use JNI. 
Some
Suggestion?