Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
morenoju
Partner - Specialist
Partner - Specialist

Connect to a different DB if connection fails

Hi,

If I have a redundant data warehouse (basically two different DB that keep synchronized with the same data). Is it possible to configure the load data script of a Qlik Sense application so if the main DB is not available it automatically connects to the backup DB?

Thanks.

Labels (1)
1 Solution

Accepted Solutions
lorenzoconforti
Specialist II
Specialist II

Something along these lines:

 

set ErrorMode = 0; //this tells Qlik Sense to keep loading the script regardless of the error

LIB CONNECT TO 'YourConnection1'; //you try to connect but it fails

if ScriptErrorCount > 0 then //if the connection fails an error will be captured
     LIB CONNECT TO 'YourConnection2'; //in case of failute, connect to your second database
end if

set ErrorMode = 1; //set back error mode to 1 

 

 

See also the documentation:

https://help.qlik.com/en-US/sense/November2019/Subsystems/Hub/Content/Sense_Hub/Scripting/ErrorVaria...

View solution in original post

2 Replies
lorenzoconforti
Specialist II
Specialist II

Something along these lines:

 

set ErrorMode = 0; //this tells Qlik Sense to keep loading the script regardless of the error

LIB CONNECT TO 'YourConnection1'; //you try to connect but it fails

if ScriptErrorCount > 0 then //if the connection fails an error will be captured
     LIB CONNECT TO 'YourConnection2'; //in case of failute, connect to your second database
end if

set ErrorMode = 1; //set back error mode to 1 

 

 

See also the documentation:

https://help.qlik.com/en-US/sense/November2019/Subsystems/Hub/Content/Sense_Hub/Scripting/ErrorVaria...

morenoju
Partner - Specialist
Partner - Specialist
Author

This is great! Thank you!