PING command
The PING command tests the network response time of the underlying connectivity between a client and a connected database server.
Authorization
None
Required connection
Database
Command syntax
Command parameters
- db_alias
- Specifies the database alias for the database on a DRDA server that the ping is being sent to. This parameter, although mandatory, is not currently used. It is reserved for future use. Any valid database alias name can be specified.
- REQUEST packet_size
- Specifies the size, in bytes, of the packet to be sent to the server. The size must be between 0 and 32767 inclusive. The default is 10 bytes. This option is only valid on servers running Db2® Version 8 or later, or Db2 for z/OS® Version 8 or later.
- RESPONSE packet_size
- Specifies the size, in bytes, of the packet to be returned back to client. The size must be between 0 and 32767 inclusive. The default is 10 bytes. This option is only valid on servers running Db2 Version 8 or later, or Db2 for z/OS Version 8 or later.
- number_of_times
- Specifies the number of iterations for this test. The value must be between 1 and 32767 inclusive. The default is 1. One timing will be returned for each iteration.
Examples
Example 1
To test the network
response time for the connection to the host database
hostdb
once: db2 ping hostdb 1
or
db2 ping hostdb
The command will display output that looks like this:
Elapsed time: 7221 microseconds
Example 2
To test the network response time for the connection
to the host database
hostdb
5 times:
db2 ping hostdb 5
or
db2 ping hostdb 5 times
The command will display
output that looks like this: Elapsed time: 8412 microseconds
Elapsed time: 11876 microseconds
Elapsed time: 7789 microseconds
Elapsed time: 10124 microseconds
Elapsed time: 10988 microseconds
Example 3
To test the network response time for a connection to the host
database
hostdb
, with a 100-byte request packet and
a 200-byte response packet: db2 ping hostdb request 100 response 200
or
db2 ping hostdb request 100 response 200 1 time
Usage notes
A database connection must exist before invoking this command, otherwise an error will result.
The elapsed time returned is for the connection between the IBM® data server client and the Db2 server.
This command will not work when it is used from a Db2 Universal Database Version 7 client through a Db2 Connect Version 8 to a connected Db2 host database server.