Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
FrankC
Creator
Creator

Dynamic Server Connection Qlik Sense

I would like to create a connection to a sql server in qlik sense, but I would like the server to be driven by a variable.  Is this possible?  

 

thanks for your advice!

Labels (1)
1 Solution

Accepted Solutions
TimvB
Creator II
Creator II

Yes, it is possible to dynamically make connections. This is how it works:

  • Load a table with connection parameters
  • Use the peek() function to extract the connection parameter values (e.g. username and password) from the table and store them in variables.
  • Use the $-sign substitution to replace username and password at the end of your connection string when executing a CONNECT TO statement

You can best start from an existing CONNECT TO statement with unscrambled credentials. For an OLE DB connection, there are user ID and password parameters that accept unscrambled values. For example (using the SQL Server Native Client):

 

CONNECT TO

[Provider=SQLNCLI11;Server=$(vServerAddress); Database=$(vDataBase);Uid=$(vUsername);Pwd=$(vPassword);];

 

You can find the exact connection string in the QMC > Data connections > YourConnector > Connection string

 

Hope it helps!

 

 

View solution in original post

4 Replies
TimvB
Creator II
Creator II

Yes, it is possible to dynamically make connections. This is how it works:

  • Load a table with connection parameters
  • Use the peek() function to extract the connection parameter values (e.g. username and password) from the table and store them in variables.
  • Use the $-sign substitution to replace username and password at the end of your connection string when executing a CONNECT TO statement

You can best start from an existing CONNECT TO statement with unscrambled credentials. For an OLE DB connection, there are user ID and password parameters that accept unscrambled values. For example (using the SQL Server Native Client):

 

CONNECT TO

[Provider=SQLNCLI11;Server=$(vServerAddress); Database=$(vDataBase);Uid=$(vUsername);Pwd=$(vPassword);];

 

You can find the exact connection string in the QMC > Data connections > YourConnector > Connection string

 

Hope it helps!

 

 

FrankC
Creator
Creator
Author

So use the same concept that was in the include in qlikview and update the connection string in cmc for the library?   

 

Thanks for the advice!

 

 

fabdulazeez
Partner - Creator III
Partner - Creator III

When I try this for Rest connection I am getting below error for Qlik sense .

 

CONNECTs other than LIB CONNECT are not available in this script mode.

janyf
Partner - Contributor III
Partner - Contributor III