Re: using environment value in DATABASE statement
Posted in 1995
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
The answer is written on page 7-72 of the INFORMIX-4GL Reference Manual (Vol.2): [...] DATABASE database_name [EXCLUSIVE] [...] 2. In an INFORMIX-4GL program, the DATABASE statement can serve two purposes, one procedural and the other non-procedural. It makes the named database the current database (procedural), and it tells the compiler where to find information about variable defined LIKE columns in a table (non-procedural) To serve the non-procedural purpose, the DATABASE statement must occur outside any routine and precede the GLOBALS statement when you use indirect data typing with the LIKE clause. The database_name must be explicitly expressed and not given as a program variable. [...] Process that called compiler must have UID with CONNECT privilege to database database_name. Before moving application from the Development Environment to the Production Server you should recompile it with database_name matching the Production Database Name (if the Development and the Production Databases have different names). Take care, Pavel <pavel@cso.spb.su> ------------------------------------------------------------------------------- In article <46p030$lj4@natasha.rmii.com> Stephen C. Dickey wrote: > I am trying to connect to a specific database that is defined in an > environment variable called "DB_NAME". > > The following syntax gives a compiler error saying fgl_getenv is not a > database. > > DATABASE fgl_getenv("DB_NAME") > > Does anyone have any suggestions here or know whether this will work > somehow? > Thanks...scd >