Re: How do you choose database at RUNTIME in r4gl?
Posted in 1994
->mlester@lonestar.utsa.edu (Micheal W. Lester) writes: -> ->>SCENERIO: ->>We have two systems, production and development. ->>ISTAR is installed on both systems so we can perform remote queries. -> ->>We have scores of 4gl reports that share a common 4gl GLOBAL header file. ->>When we wish to access data that is on production, we change the statement ->> database lotsadata ->>to ->> database lotsadata@production -> ->>and recompile the program. When we run the program on development, we will ->>get production data. ->>... -> ->>Is there a way that we can specify the database name at run time, instead ->>of compile time? Maybe make r4gl look at the contents of a UNIX ->>environmental variable, DBNAME? alan@den.mmc.com (Alan Popiel) comments: I've watched this thread for a while, and I don't still have the original posting. (The info above was stolen from someone else's answer.) I don't remember whether Micheal is running OnLine or SE, so my answer below may not apply to him. I have successfully used the following snippet of code in a Standard Engine application, to connect locally or remotely to the same database. Since Micheal's development and production DBs have the same structure, I would presume that this technique should also work for him, if he is using SE. DEFINE dbname CHAR(40) ... { Note: db_local is a GLOBAL variable which is set from an environment var fetched using fgl_getenv() } IF db_local = "true" THEN CALL msg_at_bottom ("Connecting to local database.") LET dbname = "vital1" ELSE CALL msg_at_bottom ("Connecting to database on remote host.") LET dbname = "//everest/home/database/vital1" END IF WHENEVER ERROR CONTINUE DATABASE dbname { Open database. } IF STATUS <> 0 THEN { Check for error on open. } ... My point in posting is that I have not seen any references to using the format "//host/path1/path2/dbname" for specifying the database name. I am using an ooold version of Informix, so I wonder: Is this format still supported in newer versions of Standard Engine?? Regards, Alan ___________________________ ______________________| R. Alan Popiel |__________________________ \\ Internet: | Martin Marietta, SLS | / \\ alan@den.mmc.com | P.O. Box 179, M/S 3810 | Std disclaimers apply. / )Voice: | Denver, CO 80201-0179 USA | ( / 303-977-9998 |___________________________| (But you knew that!) \\ /________________________) (____________________________\\