rakesh
rakesh

Reputation: 59

How to pass the parameter

I have a jenkins JOb which is calling the BAT file which contains the call for As java -jar testrunscripts/SQLWorkbench/sqlworkbench.jar -url=jdbc:as400:/;"translate binary"=true;naming=sql;libraries=; -driver=com.ibm.as400.access.AS400JDBCDriver -username=-password=-driverjar=E:\\\\resources\\lib\\jt400.jar -script='testrunscripts/HISTORYANDNEWDIFF.sql'

1-Jenkins Integrats the SQLWorkbench which calls the one sqlscript(HISTORYANDNEWDIFF.sql). which needs the dynamic table name required .

WbExport -file='E:\\TestingDATABASE\\history_XAXPGRFE.csv' -type=text    -delimiter=',';
select * from %SOURCE%.XAXPGRFE where XPORIG='JAVAPGM'

How would pass the parameter to the query from the jenkins pipeline to bat file and then sql script

Upvotes: 0

Views: 386

Answers (1)

wmli
wmli

Reputation: 1670

Your question is a bit unclear but try to call the bat script from your Jenkins job with a key value pair:

your_bat_script.bat param1=value1

and then in the bat script call the SQL Workbench /J script (HISTORYANDNEWDIFF.sql) using the -variable flag:

java -jar testrunscripts/SQLWorkbench/sqlworkbench.jar -url=jdbc:as400:/;"translate binary"=true;naming=sql;libraries=; -driver=com.ibm.as400.access.AS400JDBCDriver -username=-password=-driverjar=E:\\resources\lib\jt400.jar -script='testrunscripts/HISTORYANDNEWDIFF.sql -variable %1'

http://www.sql-workbench.net/manual/commandline.html#cmdline-vardef

%1 will contain param1=value1

Upvotes: 1

Related Questions