Creates a named connection to a database engine
DBMS [WITH ENGINE
argVar[,... ]]DBMS [WITH ENGINE
- Name of engine to associate with the connection. If the clause is not used, Panther opens the connection on the default engine.
- Name of connection to be opened.
- Name of connection option. Names and number of available options is engine-specific.
- Variable that contains the value assigned to the option, or a quoted string. Use this variant when the value might contain spaces and/or punctuation. Spaces are permitted around the equal sign.
- Literal value, either a quoted string or a colon-expanded expression, assigned to the connection option.
DBMS DECLARE CONNECTIONopens a session on a database engine. If the statement executes successfully, it allocates a connection structure and adds it to the list of open structures.
Applications which must connect to two or more database servers should declare a named connection to each server. If you are connecting to two or more database engines, you must declare a connection for each engine.
The combination of necessary or supported options is engine-specific. Common options include
SERVER. For a list of the valid options, refer to "Database Drivers."
Options can be specified using either of two ways:
WITHvariant (recommended)—The option and its argument value are separated by an equal sign (spaces are permitted), option-value pairs are comma-separated, and if the argument is a variable, it is not enclosed in quotes (and not colon-expanded). If the argument is a string, it is enclosed in quotes; spaces and special punctuation characters are permitted.
Since the variables are not colon-expanded, this variant prevents the values of variables from appearing in error messages or trace statements.
The connection remains open until it is closed with
For additional information, refer to Chapter 8, "Connecting to Databases," in Application Development Guide.
// This procedure connects to the database and has// two variables for the user and password.proc logonDBMS DECLARE c1 CONNECTION \
WITH USER=user, PASSWORD=pword, \
return// Same example as above, but using FOR rather
// than WITH. Note that the variable names are
// quoted and colon-expanded.proc logon
DBMS DECLARE c1 CONNECTION \
FOR USER ":user" PASSWORD ":pword" \