Attributes . . Usage . . Related Topics . . Tag Index . . Home
The MICONNECTION tag enables you to open a database connection. The connection persists until another connection is opened or the application exits.
| NAME | Specifies the name of the connection. |
| USER | Specifies the database user for the connection. |
| PASSWORD | Specifies the password for the database user. |
| SERVER | Specifies the dbName@serverName database name and server name
for the connection. |
| COND | A variable or variable expression that evaluates to FALSE (0) or TRUE (nonzero). Conditions are evaluated from left to right. The tag is enabled only if this condition evaluates to TRUE. For an example, see the MIBLOCK tag. |
APP_PAGES is the default connection name for the AppPage Builder repository. Universal Web Connect uses the values of the MI_DATABASE, MI_USERNAME, and MI_PASSWORD specified in the wcconfig.std configuration file to establish a database connection. You can open up to five database connections with different names. If you do not specify the NAME attribute for the tag, Universal Web Connect uses DUMMY as the connection name. If you specify the SERVER, USER, and PASSWORD attributes, a new connection is established. If these attributes are not set, the connection identified by the NAME attribute becomes the active connection.
Because only NAME is specified in the following tag, the current connection is set to the previously opened myconn connection.
<?MICONNECTION NAME="myconn">
If you use the same connection name multiple times, the old connection is disconnected, and the connection is reestablished using the new attributes with the same connection name. Once you have established a database connection, you can use the connection name in the CONN attribute of the MISQL tag and in the MIconnObj variable to retrieve large objects. If you do not specify a connection name, execution takes place on the currently active database connection.
The following AppPage illustrates the use of the MICONNECTION tag to perform several database queries on different databases in the same AppPage:
<HTML> <BODY> ... <?MICONNECTION NAME="con1" SERVER="sales@venus_db" USER="rsmith" PASSWORD="pass1234"> <?MISQL SQL="select name, company from customers;"> <B>$1</B>, $2<BR><?/MISQL> <?MICONNECTION NAME="con2" SERVER="payroll@orion" USER="rsmith" PASSWORD="pass4567"> <?MISQL SQL="select first, last from employees;"> <B>$1</B>, $2<BR><?/MISQL> ... </BODY> </HTML>
For information about how to escape special characters (", { , }, and $) so that they are interpreted literally, see Special Characters in AppPage Tags.