Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
martel
Creator
Creator

[TOS 6.2.2] java.sql.SQLException: ERROR: syntax error at or near (Posgresql) command line into tJava on linux

Hello, 

im on Linux
i try to execute psql command line from tJava routine

but no query are good... but when i execute in command line linux are correctly execute.

here for exemple sql query :

"\"\\SELECT NOW();\""

 

my syntaxe are bad for Talend -> tJava  routine ?

plz dont tel me that i do not have to use psql in command line i'm forced by the existing.

 

ProcessBuilder pb = new ProcessBuilder("/usr/bin/psql" ,"-h",this.getHost(),"-p",this.getPort(),"-U",this.getLogin(),"-d",this.getDataBase(),"-c", "\"\\SELECT NOW();\"");
pb.directory(exec);
Map<String, String> env = pb.environment();

env.put("PGPASSWORD", this.getPassword());
Process p = pb.start();

 

my error message is :

java.sql.SQLException: ERROR: syntax error at or near ""SELECT NOW();""LINE 1: "SELECT NOW();" ^

i tried :

'\SELECT NOW();'
"\SELECT NOW();"
"SELECT NOW();"
"SELECT NOW()"

nothing.

if you have an idea ?
Thanks a lot.

Labels (3)
1 Solution

Accepted Solutions
martel
Creator
Creator
Author

C'est bon, j'ai trouvé, j'ai enlevé tous les caractères d'échappement utiles sous windows.

View solution in original post

1 Reply
martel
Creator
Creator
Author

C'est bon, j'ai trouvé, j'ai enlevé tous les caractères d'échappement utiles sous windows.