Focal Point
[CLOSED] dynamic connection string

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/935105661

June 29, 2009, 04:21 PM
Kowens
[CLOSED] dynamic connection string
I have an html page that will have a dropdown to various databases I can go to. Based on what they choose in the dropdown, how can I dynamically or programmatically create a connection string?

This message has been edited. Last edited by: Kerry,


Version: 8.0.0.6
Windows platform
All output formats will probably be used.
June 29, 2009, 04:36 PM
GinnyJakes
Have a -INCLUDE to a program that looks up the database type and credential information in a file that you have created, write the information to a SAVE file, then -READ into amper variables that you can use in the connect string. Then depending on the data base, you may need to set a default connection.

Here is an example of one for DB2 though you could make the engine type a variable as well.

ENGINE DB2 SET CONNECTION_ATTRIBUTES  &CONN/&DB_user,&DB_pass
ENGINE DB2 SET DEFAULT_CONNECTION &CONN


You would have to put logic around this of course. And each program would need the -INCLUDE.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
June 29, 2009, 05:39 PM
Waz
This is what we do here.

We have a -INCLUDE that processes a variable that is the name of the DB.

All you need is a list of names.

I would suggest making this secure, as it would have user/pass info.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 29, 2009, 06:08 PM
GinnyJakes
We store them in a DBA-protected data base.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
June 29, 2009, 06:20 PM
Waz
The other option is to encrypt the file, and set &ECHO to OFF, when processing.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 30, 2009, 09:29 AM
<JG>
quote:
ENGINE DB2 SET DEFAULT_CONNECTION &CONN


Set up the adapter connections in edasprof.prf and if you are using static ids and passwords
and not user specific ones then that's all you need.
June 30, 2009, 01:55 PM
Kowens
but how do I get the value of &Conn from my html page to the engine?


Version: 8.0.0.6
Windows platform
All output formats will probably be used.
June 30, 2009, 02:02 PM
GinnyJakes
How did you create your html page? Did you use the HTML Composer? Did you reference a focexec that had the amper variable &CONN in it. If the answer is yes, then the page's submit button will automatically provide the value of &CONN to the focexec.

I would suggest that you start smaller. Practice passing the value for country to a focexec against the car file until you understand that process.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google