The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.

variable support with vertica jdbc api's

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


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




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


    I hope you will find it useful



Leave a Comment

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

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.