The Contents of the SERVER_NAME Field

The SERVER_NAME field contains different information after you execute the following statements.

Executed Statement
SERVER_NAME Field Contents
CONNECT
Contains the name of the database server to which you connect or fail to connect. Field is blank if you do not have a current connection or if you make a default connection.
DATABASE
Contains the name of the database server on which the specified database resides.
DISCONNECT
Contains the name of the database server from which you disconnect or fail to disconnect. If you disconnect and then you execute a DISCONNECT statement for a connection that is not current, the SERVER_NAME field remains unchanged.
DISCONNECT ALL
Sets the field to blank if the statement executes successfully. If the statement fails, SERVER_NAME contains the names of all the database servers from which you did not disconnect. (This information does not mean that the connection still exists.)
SET CONNECTION
Contains the name of the database server to which you switch or fail to switch
If CONNECT succeeds, SERVER_NAME is set to one of the following values:
  • The ONEDB_SERVER value (if the connection is to a default database server, because CONNECT specified no database server)
  • The name of the database server (if the connection is to a specific database server)