Syntax question /i and java/Vertica JDBC

Moderator: NorbertKrupa

Post Reply
BearFan
Newbie
Newbie
Posts: 4
Joined: Thu Sep 26, 2013 1:08 am

Syntax question /i and java/Vertica JDBC

Post by BearFan » Thu Sep 26, 2013 1:17 am

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

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: Syntax question /i and java/Vertica JDBC

Post by id10t » Thu Sep 26, 2013 1:28 am

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

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: Syntax question /i and java/Vertica JDBC

Post by id10t » Thu Sep 26, 2013 2:21 am

Hi!

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

---
Best Regards
Daniel Leybovich ;)

BearFan
Newbie
Newbie
Posts: 4
Joined: Thu Sep 26, 2013 1:08 am

Re: Syntax question /i and java/Vertica JDBC

Post by BearFan » Thu Sep 26, 2013 12:53 pm

Thanks for the reply .... to read the file in, I should just need to change outputstream to inputstream?

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: Syntax question /i and java/Vertica JDBC

Post by id10t » Thu Sep 26, 2013 12:58 pm

Not exactly, but close... it always preferable to use in buffers.

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

Post Reply

Return to “Vertica Database Development”