problems with pg_restore and java

Started by Miguel Angel Hernandez Morenoover 14 years ago5 messagesgeneral
Jump to latest
#1Miguel Angel Hernandez Moreno
miguel.hdz.mrn@gmail.com

Hello

I have a program in java to make a backup running pg_restore, If you use
linux give a successful outcome.
but if you use windows I mark an error generating the socket. I think that
it could be the environment variables in Windows.
My java code is as follows.

String comando="";
String env[]={ "PGPASSWORD="+String.valueOf( jPPass.getPassword() ) };
comando=directorioBinario+" -h "+jTxIP.getText()+" -d
"+jTxNombreTabla.getText()+" -U "+jTxNombreUsuario.getText()+" -v -1
"+archivoRespaldo;

try {
*p = Runtime.getRuntime().exec(comando,env);* <-------Error in windows
InputStream es = p.getErrorStream();
arch.muestraSalidaDeError(es);
} catch (IOException ex) {
Logger.getLogger(gPrincipal.class.getName()).log(Level.SEVERE, null,
ex);
}

I use my env variable to enter the password of postgres

--
ISC Miguel Angel Hernandez Moreno

#2Merlin Moncure
mmoncure@gmail.com
In reply to: Miguel Angel Hernandez Moreno (#1)
Re: problems with pg_restore and java

On Thu, Sep 8, 2011 at 10:45 AM, Miguel Angel Hernandez Moreno
<miguel.hdz.mrn@gmail.com> wrote:

Hello

I have a program in java to make a backup running pg_restore, If you use
linux give a successful outcome.
but if you use windows I mark an error generating the socket. I think that
it could be the environment variables in Windows.
My java code is as follows.

String  comando="";
String env[]={ "PGPASSWORD="+String.valueOf( jPPass.getPassword() ) };
comando=directorioBinario+" -h "+jTxIP.getText()+" -d
"+jTxNombreTabla.getText()+" -U "+jTxNombreUsuario.getText()+"  -v -1
"+archivoRespaldo;

try {
    p = Runtime.getRuntime().exec(comando,env);   <-------Error in windows
    InputStream es = p.getErrorStream();
    arch.muestraSalidaDeError(es);
} catch (IOException ex) {
    Logger.getLogger(gPrincipal.class.getName()).log(Level.SEVERE, null,
ex);
}

I use my env variable to enter the password of postgres

The error string would be helpful.

merlin

#3Miguel Angel Hernandez Moreno
miguel.hdz.mrn@gmail.com
In reply to: Merlin Moncure (#2)
Re: problems with pg_restore and java

Sorry

This is the error that sends me

pg_restore: connecting to database for restore
pg_restore: [archiver (db)] connection to database "postgres" failed: could
not create socket: Unknown socket error (0x0000277A/10106)
pg_restore: *** aborted because of error

And this is the value of my variables

comando=: "C:\Program Files\pgAdmin III\1.12\pg_restore.exe" -h 192.170.1.89
-d postgres -U postgres -v -1 "C:\Users\Miguel\Documents\NetBeansProjects\
env[0]=PGPASSWORD=postgres

2011/9/8 Merlin Moncure <mmoncure@gmail.com>

On Thu, Sep 8, 2011 at 10:45 AM, Miguel Angel Hernandez Moreno
<miguel.hdz.mrn@gmail.com> wrote:

Hello

I have a program in java to make a backup running pg_restore, If you use
linux give a successful outcome.
but if you use windows I mark an error generating the socket. I think

that

it could be the environment variables in Windows.
My java code is as follows.

String comando="";
String env[]={ "PGPASSWORD="+String.valueOf( jPPass.getPassword() ) };
comando=directorioBinario+" -h "+jTxIP.getText()+" -d
"+jTxNombreTabla.getText()+" -U "+jTxNombreUsuario.getText()+" -v -1
"+archivoRespaldo;

try {
p = Runtime.getRuntime().exec(comando,env); <-------Error in

windows

InputStream es = p.getErrorStream();
arch.muestraSalidaDeError(es);
} catch (IOException ex) {
Logger.getLogger(gPrincipal.class.getName()).log(Level.SEVERE, null,
ex);
}

I use my env variable to enter the password of postgres

The error string would be helpful.

merlin

--
ISC Miguel Angel Hernandez Moreno

#4Miguel Angel Hernandez Moreno
miguel.hdz.mrn@gmail.com
In reply to: Miguel Angel Hernandez Moreno (#3)
Re: problems with pg_restore and java

sorry

comando=: "C:\Program Files\pgAdmin III\1.12\pg_restore.exe" -h 192.170.1.89
-d postgres -U postgres -v -1 "C:\Users\Miguel\Documents\
NetBeansProjects\file.backup"

2011/9/8 Miguel Angel Hernandez Moreno <miguel.hdz.mrn@gmail.com>

Sorry

This is the error that sends me

pg_restore: connecting to database for restore
pg_restore: [archiver (db)] connection to database "postgres" failed: could
not create socket: Unknown socket error (0x0000277A/10106)
pg_restore: *** aborted because of error

And this is the value of my variables

comando=: "C:\Program Files\pgAdmin III\1.12\pg_restore.exe" -h
192.170.1.89 -d postgres -U postgres -v -1
"C:\Users\Miguel\Documents\NetBeansProjects\
env[0]=PGPASSWORD=postgres

2011/9/8 Merlin Moncure <mmoncure@gmail.com>

On Thu, Sep 8, 2011 at 10:45 AM, Miguel Angel Hernandez Moreno
<miguel.hdz.mrn@gmail.com> wrote:

Hello

I have a program in java to make a backup running pg_restore, If you use
linux give a successful outcome.
but if you use windows I mark an error generating the socket. I think

that

it could be the environment variables in Windows.
My java code is as follows.

String comando="";
String env[]={ "PGPASSWORD="+String.valueOf( jPPass.getPassword() ) };
comando=directorioBinario+" -h "+jTxIP.getText()+" -d
"+jTxNombreTabla.getText()+" -U "+jTxNombreUsuario.getText()+" -v -1
"+archivoRespaldo;

try {
p = Runtime.getRuntime().exec(comando,env); <-------Error in

windows

InputStream es = p.getErrorStream();
arch.muestraSalidaDeError(es);
} catch (IOException ex) {
Logger.getLogger(gPrincipal.class.getName()).log(Level.SEVERE, null,
ex);
}

I use my env variable to enter the password of postgres

The error string would be helpful.

merlin

--
ISC Miguel Angel Hernandez Moreno

--
ISC Miguel Angel Hernandez Moreno

#5Miguel Angel Hernandez Moreno
miguel.hdz.mrn@gmail.com
In reply to: Miguel Angel Hernandez Moreno (#4)
Re: problems with pg_restore and java

If I leave the trust authentication server, the program runs correctly. change
is that the exec () does not add the env variable

2011/9/8 Miguel Angel Hernandez Moreno <miguel.hdz.mrn@gmail.com>

sorry

comando=: "C:\Program Files\pgAdmin III\1.12\pg_restore.exe" -h
192.170.1.89 -d postgres -U postgres -v -1 "C:\Users\Miguel\Documents\
NetBeansProjects\file.backup"

2011/9/8 Miguel Angel Hernandez Moreno <miguel.hdz.mrn@gmail.com>

Sorry

This is the error that sends me

pg_restore: connecting to database for restore
pg_restore: [archiver (db)] connection to database "postgres" failed:
could not create socket: Unknown socket error (0x0000277A/10106)
pg_restore: *** aborted because of error

And this is the value of my variables

comando=: "C:\Program Files\pgAdmin III\1.12\pg_restore.exe" -h
192.170.1.89 -d postgres -U postgres -v -1
"C:\Users\Miguel\Documents\NetBeansProjects\
env[0]=PGPASSWORD=postgres

2011/9/8 Merlin Moncure <mmoncure@gmail.com>

On Thu, Sep 8, 2011 at 10:45 AM, Miguel Angel Hernandez Moreno
<miguel.hdz.mrn@gmail.com> wrote:

Hello

I have a program in java to make a backup running pg_restore, If you

use

linux give a successful outcome.
but if you use windows I mark an error generating the socket. I think

that

it could be the environment variables in Windows.
My java code is as follows.

String comando="";
String env[]={ "PGPASSWORD="+String.valueOf( jPPass.getPassword() ) };
comando=directorioBinario+" -h "+jTxIP.getText()+" -d
"+jTxNombreTabla.getText()+" -U "+jTxNombreUsuario.getText()+" -v -1
"+archivoRespaldo;

try {
p = Runtime.getRuntime().exec(comando,env); <-------Error in

windows

InputStream es = p.getErrorStream();
arch.muestraSalidaDeError(es);
} catch (IOException ex) {
Logger.getLogger(gPrincipal.class.getName()).log(Level.SEVERE,

null,

ex);
}

I use my env variable to enter the password of postgres

The error string would be helpful.

merlin

--
ISC Miguel Angel Hernandez Moreno

--
ISC Miguel Angel Hernandez Moreno

--
ISC Miguel Angel Hernandez Moreno