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

Highlighted
Six Stars

[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.


Accepted Solutions
Six Stars

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

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

View solution in original post


All Replies
Six Stars

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

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

View solution in original post

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog