AIX | HP-UX | Linux | OS/2 | OS/390 | OS/400 | PTX | SUN | Win NT |
X | X | X | X |
| X | X | X | X |
Purpose
Specifies the database or ODBC data source to access when calling a database function. This variable can be changed multiple times within a macro to access multiple databases or ODBC data sources.
OS/400 operating system: This variable is optional. Net.Data, by default, specifies DATABASE="*LOCAL"; the DTW_SQL language environment uses the local relational database directory entry.
Windows NT, OS/2, and UNIX operating systems: Define this variable before calling any database function, except when using the DTW_ORA (Oracle) language environment. Additionally, you must use Live Connection when accessing multiple databases from the same HTML block and through the same language environment.
Specify the value of this variable using a DEFINE statement or with the @DTW_ASSIGN() function.
Values
DATABASE="dbname"
Values | Description |
---|---|
dbname | The name of the database Net.Data connects to. |
Examples
Example 1: Specifies to connect to the CELDIAL database for any SQL operations
%DEFINE DATABASE="CELDIAL" %FUNCTION (DTW_SQL) getRpt() { SELECT * FROM customer %} %HTML (report) { %INCLUDE "rpthead.htm" @getRpt() %INCLUDE "rptfoot.htm" %}
The database CELDIAL is accessed when the function getRpt is called.
Example 2: Overrides previous DATABASE definitions with DTW_ASSIGN
%DEFINE DATABASE="DB2C1" ... %HTML(monthRpt){ @DTW_ASSIGN(DATABASE, "DB2D1") %INCLUDE "rpthead.htm" @getRpt() %INCLUDE "rptfoot.htm" %}
The HTML block queries the database DB2D1, regardless of what the previous value for DATABASE was.