Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
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
mov
Esteemed Contributor III

Re: Passing userid and password to ODBC Connection

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
MVP & Luminary
MVP & Luminary

Re: Passing userid and password to ODBC Connection

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

Vizlib Head of R&D
mov
Esteemed Contributor III

Re: Passing userid and password to ODBC Connection

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

MVP & Luminary
MVP & Luminary

Re: Passing userid and password to ODBC Connection

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..

Vizlib Head of R&D
Not applicable

Re: Passing userid and password to ODBC Connection

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?

mov
Esteemed Contributor III

Re: Passing userid and password to ODBC Connection

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

meetmrudul
Contributor II

Re: Passing userid and password to ODBC Connection

hi,

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