Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have multiple connection strings that are being used. Can I create QVS file with all the connection strings in that one single file? If yes, how?
Hi,
Yes you can
in your qvs, your define these connexions
v_DB_SALESFORCE | = 'CUSTOM CONNECT TO '; |
v_DB_Oracle =' ';
//Then in your application Qvw
//you can call your conexion like this
$(v_DB_SALESFORCE);
//At the end of your connexion
DISCONNECT;
//then you can an other connexion
$(v_DB_Oracle);
DISCONNECT;
you can use as many Connection strings as you like
But: you must extract the data from each database you want to connect to before the next Connection string
occurs
connect to ...
select * from tablea
select * from tableb
connect to ...
select *from tablec
select * from tabled
other possibility: if you want only 1 qvs with only Connection strings you may work with variables and use a Sub
Sub connect (DBA)
if (DBA=1, connect to ..)
if (DBA)2, connect to ...)
in your main script you call the Sub and then extract the data
call connect(1)
select * from tablea
does this helps you?
If i have only one connection String, I can do it as :
SCRIPT:
$(Must_Include=$(Config)\ConnectionString.qvs) ;
TableA:
LOAD
....
...
And in the ConnectionString.qvs file, define the Connection String.
How will I do it if I have multiple connection strings and I want all those connection strings to be stored in a single .qvs file instead of one qvs file for each connection string?
Hi,
you can have as many connection strings as you like, i use something like this:
//First conn
set v.DBConnString1='Provider=OraOLEDB.Oracle.1;Persist Security Info=True;User ID=myUser;Data Source=mySource1;UseSessionFormat = 1;Extended Properties=""';
set v.DBConnString1Pass='RVEePSJMDSDFSDFDdeFRFNJE';
//second conn
set v.DBConnString2='Provider=OraOLEDB.Oracle.1;Persist Security Info=True;User ID=myUser;Data Source=mySource2;UseSessionFormat = 1;Extended Properties=""';
set v.DBConnString2Pass='RVEePRTSDFGSDF3453NJE';
//Connect to first db
OLEDB CONNECT TO [$(v.DBConnString1)] (XPassword is $(v.DBConnString1Pass));
//Do some stuff
DISCONNECT;
//Connect to second db
OLEDB CONNECT TO [$(v.DBConnString2)] (XPassword is $(v.DBConnString2Pass));
//Do some stuff;
DISCONNECT;
Let me know if this helps.
Kind regards,
I would use my second choice:
you define your Connection strings in a single qvs by defining a Sub
Sub connect(DBA)
if (DBA=1, connect to Database1)
if (DBA=2, connect to Database2
end Sub
you call the include like you wrote
$(Must_Include=$(Config)\ConnectionString.qvs) ;
But before extracting data you define the datasource using a parameter
CALL CONNECT(1)
TableA:
load
..
does this clarifys your question?
Hi,
Yes you can
in your qvs, your define these connexions
v_DB_SALESFORCE | = 'CUSTOM CONNECT TO '; |
v_DB_Oracle =' ';
//Then in your application Qvw
//you can call your conexion like this
$(v_DB_SALESFORCE);
//At the end of your connexion
DISCONNECT;
//then you can an other connexion
$(v_DB_Oracle);
DISCONNECT;
I will try one and if it doesn't work, will switch to the next one. Will let you know guys. Thanks
The one provided by xia worked. I had issues with Santiago's solution. Anyway, thanks guys