Connecting Query to a Data Server
- Last UpdatedJan 24, 2023
- 2 minute read
Before commands can be sent from Query to any data server, a link must be set up between the two.
To connect Query to a data server which is installed on the same machine, use one of the commands:
EXTERnal OPEn synonym token_var
EXTERnal OPEn synonym token_var [AS connect_string]
Here synonym is a text string which identifies the server daemon through which communication is to be channeled (and which therefore identifies the data server required); token_var is the name of a PML variable into which a token for the connection is to be written; and (if your data server requires login data) connect_string is a text string which confirms the User's access rights (such as their username and password).
Examples:
EXTERNAL OPEN ’MAINTENANCE’ !!MAINT AS ’bull/robert’
or:
EXTERNAL OPEN ’ODBC’ !!MAINT AS ’DSN=MAINTDAT;’
To connect Query to a data server which is installed on a different machine, use the extended form of the command:
EXTERnal OPEn synonym token_var ON host [AS connect_string]
Here synonym, token_var and connect_string are as above and host is a text string which identifies the node on the network on which the server daemon. For example, to connect to a data server on a machine called pc35, enter:
EXTERNAL OPEN ’MAINTENANCE’ !!MAINT ON ’pc35’ AS ’bull/robert’
or, alternatively, a generalized version such as:
EXTERNAL OPEN ’MAINTENANCE’ !!MAINT ON ’sqlnet’ AS ’bull/robert’
Here the alias ‘sqlnet’ has been defined so as to point to the current host for, say, an SQL DB server.
To disconnect Query from a data server to which it is currently connected, use the command:
EXTERnal CLOse token
Here token is the token for the communication channel which was supplied by a successful EXTERNAL OPEN command (and stored in the token_var variable).
EXTERnal CLOse $!!MAINT
Note:
The '