Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Passing userid and password to ODBC Connection

In our company we are forced to change passwords every 90 days. So in my .qvw that generates my qvd's I don't want to have to go change my username and password for the ODBC connection for every single one every 90 days. Is there a way I can update one text file and then have all of my qvw's reference that one file for the username and password?

 

ODBC

CONNECT32 TO [EDW] (XUserId is right here is where I want it to point to an excel/text file, XPassword is right here is where I want it to point to an excel/text file);

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Something like this (I'm using non-scrambled):

// Assuming it is Excel file with columns USERID and PASSWORD:
LoginData:
LOAD
USERID,
  PASSWORD
FROM Data.xlsx (ooxml, embedded labels, table is Sheet1);

// Define variables:
LET vUser = peek('USERID');
LET vPassword = peek('PASSWORD');

// Don't need this table anymore:
DROP TABLE LoginData;

// Use variables in CONNECT
ODBC CONNECT TO [EDW] (UserId is $(vUser), Password is $(vPassword));

// DELETE these variables so they are not available in app front end:
LET vUser = null();
LET vPassword = null();

Regards,

Michael

View solution in original post

6 Replies
rbecher
MVP
MVP

Hi Neil,

you cannot point to a file inside the CONNECT statement but you could use variables which could be initialized from a file..

- Ralf

Astrato.io Head of R&D
Anonymous
Not applicable
Author

Yes, variables is a way to go.  I guess you cannot use scrambled in this case.

rbecher
MVP
MVP

Not without creating new CONNECT statement manuelly with new credentials and then store XUserId/XPassword into a file. But as I remember right there was a dll you could use to scramble with an external program..

Astrato.io Head of R&D
Not applicable
Author

Variables would be fine, but where would I assign what the variables are? It would have to be somewhere else so it can be one central location for all of my programs.


If it's not too much could you give an example snippet of code on how to do that?

Anonymous
Not applicable
Author

Something like this (I'm using non-scrambled):

// Assuming it is Excel file with columns USERID and PASSWORD:
LoginData:
LOAD
USERID,
  PASSWORD
FROM Data.xlsx (ooxml, embedded labels, table is Sheet1);

// Define variables:
LET vUser = peek('USERID');
LET vPassword = peek('PASSWORD');

// Don't need this table anymore:
DROP TABLE LoginData;

// Use variables in CONNECT
ODBC CONNECT TO [EDW] (UserId is $(vUser), Password is $(vPassword));

// DELETE these variables so they are not available in app front end:
LET vUser = null();
LET vPassword = null();

Regards,

Michael

Anonymous
Not applicable
Author

hi,

This solution does not work in case of MySQL if I am also fetching DSN Name from excel.