We're Moving!

The Vertica Forum is moving to a new OpenText Analytics Database (Vertica) Community.

Join us there to post discussion topics, learn about

product releases, share tips, access the blog, and much more.

Create My New Community Account Now


variable support with vertica jdbc api's — Vertica Forum

variable support with vertica jdbc api's

does vertica have jdbc support for executing vsql scripts with variables? 

Comments

  • Hi ,
    Why you want to do that ?
    VSQL  is command line utility , jdbc already have the ability to interact with the database natively .

     

    If you used Java you  don't need VSQL unless i miss somting in your quetion .

     

    Thanks 

     

  • we are trying to figure out weather we should run our sql scripts from commandine or from a java program using jdbc api.  my question was --

     

    1. does jdbc api has a way to take script path as an input and execute it. From what i read it looks like it expects individual sql statements to execute. 

    2.  does it allow you to pass variables as  vsql command line does  using -v option ? 

  • Hi
    Their is no native API for VSQL , to call VSQL  using java you simply need to call the exec java method (see example - http://www.mkyong.com/java/how-to-execute-shell-command-from-java/ ) , using this method you wlll be able to use the -v parameter as a regulare command line execution of VSQL .

     

    I see many disadvantage of using this method , below some of them :

     

    • Requires the existence of vertica client instalation on the machine you execute the script .
    • More complicated Error handling .


    I advice you to modify the attach class (see below ) and extend it to incluce all your use cases .
    https://gist.github.com/joe776/831762

     

    I hope you will find it useful

     

    Thanks

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file