Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator III
Creator III

variable in lib connection

Hi All,

I want to pass my variable which stored connection string. 

Below is what my code which is not working. 

let vuser='ABC';

let vDS='XYZ';

let VPass='12345';

SET VDEV ='OLEDB CONNECT TO [Provider=OraOLEDB.Oracle;User ID=$(vuser);Data Source=$(vDS);]  (XPassword=$(VPass))';

LIB CONNECT TO '$(VDEV)';

the above code is not working. please suggest 

 

Labels (2)
3 Replies
Highlighted
Creator III
Creator III

Re: variable in lib connection

data connections need to be created as (securable) ressources in the qmc. 

you could create several connections, and use their names in the variable VDEV. 

but once created, i don't think data source, username and pw are not editable entities of a connection. 

 

Highlighted
Creator III
Creator III

Re: variable in lib connection

Yes, I understand . But when I move from dev to prod, I have to change the connection string every time. if in case missed, all QVDs will have wrong data. So I'm planning to use variable in each environment so that when the data will be correct. 

Highlighted
Partner
Partner

Re: variable in lib connection

You need to define the connection in a LIB.

 

What about creating two LIBs? One for PROD and one for DEV. If your variable states  'PROD' then connect to the lib called MyDatabasePROD and if its 'DEV' then MyDatabaseDEV (LIB:\\MyDatabase$(yourVariable)\).

Or even simpler let the variable contain the name of your lib. LIB:\\$(yourVariable)\

 

Plees ekskuse my Swenglish and or Norweglish spelling misstakes