Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Failover/secondary DB connection string

Hi Guys,

I have a QVW application that generates QVD files from primary SQL database.

I also have a mirror database copy of that primary server.

What function should I use or what statement to use in the connection string so in case of primary server is down then it will automatically connect to the mirror database?

1 Solution

Accepted Solutions
rubenmarin

Hi Lokesh, I didn't tried but maybe using the script error variables, ie:

SET ErrorMode = 0; //If any error is found, continue execution

CONNECT To  MainConnection;

IF ScriptError >0 then //If there was an error connecting try this

     SET ErrorMode = 1; // If this one fails an error must be thrown

     CONNECT TO FailoverConnection;

ENDIF

SET ErrorMode = 1; // In case there was no error, set ErrorMode to 1 for the rest of the script.

View solution in original post

3 Replies
Digvijay_Singh

PradeepReddy
Specialist II
Specialist II

try something like this...

DB Connection1; //Primary Database connection

IF ScriptError=3 or ScriptError=4 then

     DB Connection 2; // mirror database connection

END IF

Load Stmt1;

Load Stmt2;


rubenmarin

Hi Lokesh, I didn't tried but maybe using the script error variables, ie:

SET ErrorMode = 0; //If any error is found, continue execution

CONNECT To  MainConnection;

IF ScriptError >0 then //If there was an error connecting try this

     SET ErrorMode = 1; // If this one fails an error must be thrown

     CONNECT TO FailoverConnection;

ENDIF

SET ErrorMode = 1; // In case there was no error, set ErrorMode to 1 for the rest of the script.