Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Hull and Outfitting

Connecting Query to a Data Server

  • Last UpdatedJan 07, 2026
  • 2 minute read

Before commands can be sent from Query to any data server, a link must be set up between the two.

  1. To connect Query to a data server which is installed on the same machine, use one of the following commands:

    EXTERnal OPEn synonym token_var

    EXTERnal OPEn synonym token_var [AS connect_string]

    Where:

    • synonym = A text string which identifies the server daemon through which communication is to be channelled (and which therefore identifies the data server required).

    • token_var = The name of a PML variable into which a token for the connection is to be written.

    • (If your data server requires login data) connect_string = A text string which confirms the users access rights (such as their username and password).

      Examples:

      EXTERNAL OPEN ’MAINTENANCE’ !!MAINT AS ’bull/robert’

      or

      EXTERNAL OPEN ’ODBC’ !!MAINT AS ’DSN=MAINTDAT;’

  2. 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]

    Where synonym, token_var and connect_string are as above.

    host = 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 generalised version such as

    EXTERNAL OPEN ’MAINTENANCE’ !!MAINT ON ’sqlnet’ AS ’bull/robert’

    Where the alias ‘sqlnet’ has been defined so as to point to the current host for, say, an SQL database server.

  3. To disconnect Query from a data server to which it is currently connected, use the command

    EXTERnal CLOse token

    Where:

    • token = The token for the communication channel which was supplied by a successful EXTERNAL OPEN command (and stored in the token_var variable).

      Example:

      EXTERnal CLOse $!!MAINT

      Note: The $ prefix used to expand the variable !!MAINT to give the token value.

TitleResults for “How to create a CRG?”Also Available in