*****************************************************
*********          VistaSqlTrigger          *********
*****************************************************

Version v01, 12.04.2017
Author: Gerry Broennimann, IBM Switzerland (gebr@ch.ibm.com)

PURPOSE
-------
This program can be used to execute a single query on multiple environments (batch execution).
The query results for each environment is saved in a report file (/out/report.txt).


USAGE
-----
Define an SQL query and DB configurations (see below). Execute the program using "launch.bat", which opens a command line window.
Alternative: Start a command line window and enter 
java -jar VistaSqlTrigger.jar
After the SQL is executed on each defined environment, a report file is written in /out/report.txt.


LIMITATIONS
-----------
Currently only SELECT queries are supported. If no "fetch first xx rows only" is provided in the SQL it is automatically limited to 100 rows for performance reasons.


DEFINE A SQL QUERY
------------------
1)
Edit file /queries/query.sql

The SQL to be executed. ";" can be used or omitted.
If no "fetch first xx rows only" is provided in the SQL it is automatically limited to 100 rows for performance reasons.

2)
Edit file /queries/query.json

This file defines on which environments the SQL needs to be executed. Make sure to keep the file as a valid JSON structure.
The following parameters can be set:

- queryname
Use as a title in the generated reports. No impact on the query execution.

- environments
Define the environments on which the SQL query should run. Use the "alias" for a DB, e.g. "prodSG" instead of DB name ("vidpdbsg").
This parameter maps to db2DBAlias in configMulti.json.
Multiple environments can be used in JSON array notation, for example:
environments : ["prodSG", "prodSH", "prodZH"]


DEFINE DB CONFIGURATIONS
------------------------
Edit file /config/configMulti.json

This file is in JSON format. Make sure to keep it in valid JSON structure.
The following parameters can be set for each configuration (multiple configurations are supported using JSON array notation):

- db2Url
jdbc connection string incl. host and port.

- db2User
Username for this DB.

- db2Password
Password for this user / DB.

- db2DBName
The "real" name of the DB.

- db2DBAlias
A different descriptor for the DB for convenient usage. Also, this parameter maps to the "environments" parameter in query.json.

Sample:
[
{
	db2Url		: "jdbc:db2://beodbjump:60000",
	db2User		: "ADMIBMxxx",
	db2Password	: "****",
	db2DBName	: "vidpdbsg",
	db2DBAlias	: "prodSG"
},
{
	db2Url		: "jdbc:db2://beodbjump:60000",
	db2User		: "ADMIBMxxx",
	db2Password	: "****",
	db2DBName	: "vidpdbsh",
	db2DBAlias	: "prodSH"
}
]



