Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
We have one Redshift and another MySQL server Database.
I have created two separate DSNs for same.
We have a requirement, where just by changing the variable names, the user should be able to switch between MySQL and Redshift.
I have created three variables for DSN, UserName and Password and have the string in Edit Script section as :
ODBC CONNECT TO $(vDSN) (XUserId is $(vUser), XPassword is $(vPassword));
If I use below statement, the LOAD statement for aliasing does not work, but data gets loaded -
ODBC CONNECT TO $(vDSN) ;
Any inputs for same.
Even if I provide Username and Password, the LOAD statement is not working for MySQL.
Please let me know your inputs on same.
Thanks & Regards,
MK
Hi,
You can use the If statement.
If variable = 1 then
Connect to Mysql
Else
Connect to RedShift
End if
Regards,
Kaushik Solanki
Thanks Kaushik for the quick reply.
I can use that, but after that as well, If I am taking values of UserName, DSN and Password for MySQL from variable, LOAD statement asliasing does not work.
Hi,
It wont work because the username and password should be in encrypted format. Other wise it wont work and I dont think so its possible to know what encryption technique is used to encrypt the data.
Regards,
Kaushik Solanki
agrreed with kaushik.solanki..you need to create the connection string inside the QV and its encrypted with the logic defined by Qlik so you cannot rebuild it using the variables ...try like creating to different connection strings and based on the condition you could connect for the required data base
I have first connected the same using direct ODBC, connect box.
After that, I just copy paste the encrypted username and Password into variables.
LOAD statement works well for Redshift but not for MySQL.
If I just use ODBC connection for MySQL, without variables, then LOAD statement works as expected.
But in case of variables does not.