Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
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

Re: Failover/secondary DB connection string

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
Honored Contributor III

Re: Failover/secondary DB connection string

pradeepreddy
Valued Contributor II

Re: Failover/secondary DB connection string

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;


Re: Failover/secondary DB connection string

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