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