Page 1 of 1

Syntax question /i and java/Vertica JDBC

Posted: Thu Sep 26, 2013 1:17 am
by BearFan
I am not sure what I am doing wrong here .. this is not my area of expertise. Essentially I need to have a file run based on a trigger from an event in SQL, for other things like this, we have called a simple java program to do things like run a copy command.

For this, I need to execute commands inside a text file

I am getting the error

Error: java.sql.SQLException: [Vertica][VJDBC](100081) ERROR: Syntax error at or near "\"


when running this

boolean result= stmt.execute ("\\i /home/dbadmin/text.txt;");

basically I want to execute ( I have // instead of / because it is apparantly an escape character)

\i /home/dbadmin/text.txt;


Any help would be appreciated

Thanks

Re: Syntax question /i and java/Vertica JDBC

Posted: Thu Sep 26, 2013 1:28 am
by id10t
Hi!

It's inner vsql syntax (meta command). There are no JDBC API - "export to file", you have write file via Java IO interface (OutputStream ...)

Re: Syntax question /i and java/Vertica JDBC

Posted: Thu Sep 26, 2013 2:21 am
by id10t
Hi!

Especially for you ;) viewtopic.php?f=80&t=1390

---
Best Regards
Daniel Leybovich ;)

Re: Syntax question /i and java/Vertica JDBC

Posted: Thu Sep 26, 2013 12:53 pm
by BearFan
Thanks for the reply .... to read the file in, I should just need to change outputstream to inputstream?

Re: Syntax question /i and java/Vertica JDBC

Posted: Thu Sep 26, 2013 12:58 pm
by id10t
Not exactly, but close... it always preferable to use in buffers.

http://www.mkyong.com/java/how-to-read- ... r-example/