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

Using a Config file for ODBC Connect statment values

I'd like to read in a standard text configs.csv config file to load values for the ODBC Connect Statement.

Example:

config.csv:

conf_value, conf_field
odbc_name,test
user_id,user
password,password

script:

ODBC CONNECT TO confvalue1 (UserId isconfvalue2, Password is confvalue3);

Is this possible? When I try adding variables to the ODBC CONNECT statement I am getting syntax errors.

Thanks

1 Reply
fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi PMCanada, yes it is possible!

here is a sample:

_______________________________________________________________________

tmp:

LOAD * INLINE [

    conf_field, conf_value

    ODBCName, YourODBCName

    UserID, YourUserID

    Password, YourPassword

];     //replace this inline load with your load from the csv file

let vODBCName = lookup('conf_value', 'conf_field', 'ODBCName', 'tmp');

let vUserID = lookup('conf_value', 'conf_field', 'UserID', 'tmp');

let vPassword = lookup('conf_value', 'conf_field', 'Password', 'tmp');

drop table tmp;

 

ODBC CONNECT TO $(vODBCName) (UserId is $(vUserID), Password is $(vPassword));

_______________________________________________________________________

Hope this helps you.

Regards,

Fernando