Backup and restore through JDBC
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?
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
Import Notes
Resolved by subject fallback
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
regards
Marlon
2006/9/29, Albe Laurenz < all@adv.magwien.gv.at>:
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
--
Marlon
"A busca infinita à felicidade nos priva de vivê-la a cada dia..." (Elba
Lucas)
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
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 knowpg_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
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
regards,Marlon
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
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 makeYou 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
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 Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
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 makeYou 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
I have interest in working,how i could start ?
regards,marlon
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
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 usingJNI,
AFAIK.
Recently, there was the proposal to extract that knowledge to a
library
(making pg_dump itself just a wrapper). This sounds valuable moreand
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
ok. i'm trying start.
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 makepg_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
Andrew Dunstan <andrew@dunslane.net> 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
Tom Lane wrote:
Andrew Dunstan <andrew@dunslane.net> 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
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 Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org