Re: Connect to a database from an environment variable
Posted in 1995
See my missive earlier today on the subject of database name handling. Note that you cannot determine the name of the database which is used by the compiler by environment variable -- if you need to have different database names (which I doubt), then you'll have to pre-process the code to place the correct name in the I4GL source code. However, it is most probable that you will be able to use a fixed database name at compile time, and choose the name dynamically at run-time using a variant on the technique I illustrated earlier. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> }From: balaji@icsware.com (Srinivasan Balaji) }Date: Fri, 27 Oct 1995 17:19:20 GMT }X-Informix-List-Id: <news.18328> } }I have to connect to the database which is set in an environment }variable. I have a globals file in which I define my database and }some other variables. I tried the following in that globals file. } }1. } }DATABASE fgl_getenv("DB_NAME") }GLOBALS } DEFINE .... }END GLOBALS } } This gave an error saying it couldn't find the database fgl_getenv } }2. }Define l_db CHAR(20) }let l_db = fgl_getenv("DB_NAME") This is not inside a function/report/main and is invalid syntax. }DATABASE l_db This refers to a database l_db, not to a variable. }GLOBALS } DEFINE ..... }END GLOBALS } }This gives an error on the let statement. } }If anyone can help me on this, I would appreciate it. } }Thanks }Balaji.