I am trying to create a script that tests the database connection .I want variable value to be '0' when database connection fails so that variable value can be used to send email alerts about the connection issue.And I also want to create a qlik table with database name and sysdate as NULL if the db connection fails.Here is the script I created but when I give incorrect db creds in connection string, script is not entering IF block.Can some one correct my script.
Set NullInterpret = '';
LET vDBConnection = 1;
Trace 'Now Testing DBConnection';
OLEDB CONNECT TO [Provider=OraOLEDB.Oracle.1;Persist Security Info=True;User ID=xxxxx;Data Source=xxxx;Extended Properties=""] (XPassword is xxxxxx);
SQL SELECT 'Databse Name' as DBNAME,SYSDATE FROM DUAL;
LET DBconnection_DATE =PEEK('SYSDATE',0,'StreamHist');