Connect to a queue manager, using the MQSERVER environment variable on Linux
When an IBM MQ application is run on the IBM MQ MQI client, it requires the name of the MQI channel, the communication type, and the address of the server to be used. Provide these parameters by defining the MQSERVER environment variable.
Before starting
Before you start this task, we must complete the task, Set up the server using the command line on Linux, and save the following information:
- The host name or IP address of the server and port number that you specified when creating the listener.
- The channel name of the server-connection channel.
About this task
This task describes how to connect an IBM MQ MQI client, by defining the MQSERVER environment variable on the client.
We can give the client access to the generated client channel definition table, amqclchl.tab instead; see Accessing client-connection channel definitions.
Procedure
- Log in as the userid that you created in Step 1 of Set up the server using the command line on Linux.
- Check the TCP/IP connection. From the client, enter one of the following commands:
- ping server-hostname
- ping n.n.n.n
n.n.n.n represents the network address. We can set the network address in IPv4 dotted decimal form, for example, 192.0.2.0. Alternatively, set the address in IPv6 hexadecimal form, for example 2001:0DB8:0204:acff:fe97:2c34:fde0:3485.
If the ping command fails, correct your TCP/IP configuration.
- Set the MQSERVER environment variable. From the client, enter the following command:
export MQSERVER=CHANNEL1/TCP/'server-address (port)'Where:
- CHANNEL1 is the server-connection channel name.
- server-address is the TCP/IP host name of the server.
- port is the TCP/IP port number the server is listening on.
If we do not give a port number, IBM MQ uses the one specified in the qm.ini file, or the client configuration file. If no value is specified in these files, IBM MQ uses the port number identified in the TCP/IP services file for the service name MQSeries . If an MQSeries entry in the services file does not exist, a default value of 1414 is used. It is important that the port number used by the client and the port number used by the server listener program are the same.
What to do next
Use the sample programs to test communication between the client and server; see Testing communication between a client and a server on Linux. Parent topic: Set up the server and client using the command line on Linux