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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
israrkhan
Specialist II
Specialist II

Dynamic Connection

Hi, Community,

How can we create a dynamic connection, e.g, we have two servers and both having the DB.

What i want if one server is down, then Qlikview connect to other server automatically...

it seems simple. but dont have enough experience to deal with...

Kindly Help.

Kind Regards


4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Sort of. Set error mode to 0 (SET ErrorMode = 0;) so the script will continue when an error is encountered. Add two load statements for both databases. The second one should be in an if-then block. In the if condition check the value of the scripterror variable to check for database related errors. For example a scripterror value 9 means the database was not found. You can find the error codes and their meaning in the help file. Alternatively you could just check if the table that should have been created exists and/or if there are any rows in it using the TableNumber and/or NoOfRows functions.


talk is cheap, supply exceeds demand
israrkhan
Specialist II
Specialist II
Author

Dear Gysbert,

Thank You For Your Reply. some one told me this script,

what you will say about this.?

SET ErrorMode = 0;

ODBC CONNECT TO DB1;

IF ScriptErrorCount > 0 THEN

ODBC CONNECT TO DB2;

END IF

SQL SELECT * FROM db;

Kind Regards

jagan
Partner - Champion III
Partner - Champion III

Hi Usman,

Yes, it exactly works, if one server is not reachable then the ScriptErrorCount would be > 0, so in the If condition the ODBC is connected.

SETErrorMode=0;

ODBC CONNECT TO DB1;

If ScriptErrorCount > 0 Then

     ODBC CONNECT TO DB2;

End If

SQL SELECT * FROM db;

Hope this helps you.

Regards,

Jagan.

israrkhan
Specialist II
Specialist II
Author

Thank You Mohan,

let me try..

i 'll update you

Kind Regards