Direct database specification method takes place when the database name used in a DATABASE or CONNECT TO instruction is not defined in FGLPROFILE with a 'dbi.database.dbname.source' entry. In this case, the database specification used in the connection instruction is used as the data source.
This method is well known for IBM® Informix® databases, for example to specify the IBM Informix server:
MAIN DATABASE stores@orion ... END MAIN
In the next example, the database server is PostgreSQL. The string used in the connection instruction defines the PostgreSQL database (stock), the host (localhost), and the TCP service (5432) the postmaster is listening to. As PostgreSQL syntax is not allowed in the language, a CHAR variable must be used:
MAIN DEFINE db CHAR(50) LET db = "stock@localhost:5432" DATABASE db ... END MAIN
This method tieds the compiler programs to a given database server configuration. Prefer indirect database specification method instead of direct database specification.