sp_addserver

Description

Defines a remote server, or defines the name of the local server.

Syntax

sp_addserver “lname” [, class [,” pname”]]

Parameters

lname

is the name used to address the server on your system. sp_addserver adds a row to the sysservers table if there is no entry already present for lname. Server names must be unique and must conform to the rules for identifiers.

class

identifies the category of server being added. A server class of “null” defaults to “ASEnterprise”. Table 1-4 lists allowable values for the class parameter:

Table 1-4: Allowable values for server_class parameter

class parameter value

Description

local

Local server (there can be only one) used only once after start-up, or after restarting Adaptive Server, to identify the local server name so that it can appear in messages printed by Adaptive Server

null

Remote server with no category defined

ASEnterprise

All versions of Adaptive Server Enterprise; support for SQL Server 4.9 is not provided.

ASAnywhere

Adaptive Server Anywhere version 6.0 or later.

ASIQ

A server with server class ASIQ is any version of Adaptive Server IQ of 12.0 or later.

db2

Component Integration Services only An IBM DB2 database accessed through:

  • DirectConnect for MVS / TRS (can also be configured as server class direct_connect)

  • Direct (gateway less) access to Mainframe Connect

direct_connect

Component Integration Services only An Open Server-based application that conforms to the direct_connect interface specification.

sds

Conforms to the interface requirements of a Specialty Data Store™ as described in the Adaptive Server Specialty Data Store Developer’s Kit manual.

See “Remote Servers” in Chapter 2, “Understanding Component Integration Services” of the Component Integration Services User’s Guide for details on these parameter values.

pname

is the name in the interfaces file for the server named lname. This enables you to establish local aliases for other Adaptive Servers or Backup Servers that you may need to communicate with. If you do not specify a pname, lname is used.

Component Integration Services only – You can use pname to specify the hostname or IP address and the port of the server you wish to connect to. This enables you to bypass the need for directory services (such as LDAP or an interfaces file) for the server when using the CT-Library. Use the following format:

NoteYou must enclose the hostname and port with single or double quotes to use this option.

Examples

Example 1

Adds an entry for a remote server named GATEWAY in master.dbo.sysservers. The pname is also GATEWAY:

sp_addserver GATEWAY

Example 2

Adds an entry for a remote server named GATEWAY in master.dbo.sysservers. The pname is VIOLET. If there is already a sysservers entry for GATEWAY with a different pname, the pname of server GATEWAY changes to VIOLET:

sp_addserver GATEWAY, null, VIOLET

Example 3

Adds an entry for the local server named PRODUCTION:

sp_addserver PRODUCTION, local

Example 4

Component Integration Services only – Adds an entry for a remote Adaptive Server with the host name “myhost” with port number 10224:

sp_addserver S1, ASEnterprise, "myhost:10224"

NoteIf you use this syntax for pname, the Adaptive Server site handler cannot successfully connect to this server; only CIS connections recognize this syntax for pname.

Example 5

Component Integration Services only – Adds an entry for a remote Adaptive Server with the host IP 192.123.456.010 with port number 11222:

sp_addserver S3, direct_connect, "192.123.456.010:11222"

Usage

Permissions

Only a System Security Officer can execute sp_addserver.

See also

Documents For information on using Component Integration Services, see the Component Integration Services User’s Guide.

System procedures sp_addremotelogin, sp_dropremotelogin, sp_dropserver, sp_helpremotelogin, sp_helpserver, sp_serveroption