The Connect sample program allows you to explore the MQCONNX call and its options from a client. The sample connects to the queue manager using the MQCONNX call, inquires about the name of the queue manager using the MQINQ call, and displays it.
The command-line syntax of the Connect sample program is:
amqscnxc [-x ConnName [-c SvrconnChannelName]] [QMgrName]
The parameters are optional and their order is not important with the exception that QMgrName, if it is specified, must come last. The parameters are:
If you do not specify the TCP/IP connection name, MQCONNX is issued with the ClientConnPtr set to NULL. If you specify the TCP/IP connection name but not the server connection channel (the reverse is not allowed) the sample uses the name SYSTEM.DEF.SVRCONN. If you do not specify the target queue manager the sample connects to whichever queue manager is listening at the given TCP/IP connection name.
If you run the sample with no command-line options the contents of the MQSERVER environment variable are used to determine the connection information. (In this example MQSERVER is set to "SYSTEM.DEF.SVRCONN/TCP/machine.site.company.com".) You see output like this:
Sample AMQSCNXC start Connecting to the default queue manager with no client connection information specified. Connection established to queue manager machine Sample AMQSCNXC end
If you run the sample and provide a TCP/IP connection name and a server connection channel name but no target queue manager name, like this:
amqscnxc -x machine.site.company.com -c SYSTEM.ADMIN.SVRCONN
the default queue manager name is used and you see output like this:
Sample AMQSCNXC start Connecting to the default queue manager using the server connection channel SYSTEM.ADMIN.SVRCONN on connection name machine.site.company.com. Connection established to queue manager MACHINE Sample AMQSCNXC end
If you run the sample and provide a TCP/IP connection name and a target queue manager name, like this:
amqscnxc -x machine.site.company.com MACHINE
you see output like this:
Sample AMQSCNXC start Connecting to queue manager MACHINE using the server connection channel SYSTEM.DEF.SVRCONN on connection name machine.site.company.com. Connection established to queue manager MACHINE Sample AMQSCNXC end